From patchwork Thu Aug 15 19:05:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 267423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 9F3642C014B for ; Fri, 16 Aug 2013 05:05:16 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=V+YjYWSnWZUPNHwS78qvK521KZqtf CVNAan4oQVy3jihLw257k1oFMB8OHDlVG6CkXviECVT64E7UHJtbZB6ZC7zYDItR zncOvQkL0iJ3cLb7AlQ8LdC8cTRPHlVdc3XmTmxJJbCAsrkUtjn/Dl0lav0+6Vfs iCJxwYgIKiYGA8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=06o8rHNzvsTwQPl67oEeoESUUMM=; b=oFd 8VGlZ3MlBS656tSw5nCA30XyUhk8JcBLKO3nzKj3ST+L98LNeVqY8x9bWOkej8Ji Y9+2+MHKU6iO0eCgoyqwa/nPykWeiLL4YEEeyxoBd2PJzs46RwfbNsNvgB0HNptw O1UVLwt5QQQpoZeK6oedu0XkodY682Lo/WK/OjdQ= Received: (qmail 2908 invoked by alias); 15 Aug 2013 19:05:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 2899 invoked by uid 89); 15 Aug 2013 19:05:10 -0000 X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 15 Aug 2013 19:05:10 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7FJ586x030636 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 15 Aug 2013 15:05:08 -0400 Received: from zalov.cz (vpn1-7-127.ams2.redhat.com [10.36.7.127]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r7FJ57oc006355 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Aug 2013 15:05:08 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id r7FJ56rl025485; Thu, 15 Aug 2013 21:05:06 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r7FJ5613025484; Thu, 15 Aug 2013 21:05:06 +0200 Date: Thu, 15 Aug 2013 21:05:06 +0200 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ICEs with bogus computed goto (PR tree-optimization/58164) Message-ID: <20130815190506.GD1814@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi! gimple_goto_dest is is_gimple_val, so can be ADDR_EXPR (though just for bad testcases), and in that case we weren't walking it in some cases. I've tried to reject ADDR_EXPRs in gimple_goto_dest, but that turned out to be much larger patch and still incomplete. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.8? 2013-08-15 Jakub Jelinek PR tree-optimization/58164 * gimple.c (walk_stmt_load_store_addr_ops): For visit_addr walk gimple_goto_dest of GIMPLE_GOTO. * gcc.c-torture/compile/pr58164.c: New test. Jakub --- gcc/gimple.c.jj 2013-05-13 09:44:53.000000000 +0200 +++ gcc/gimple.c 2013-08-15 15:22:06.745236769 +0200 @@ -4049,6 +4049,13 @@ walk_stmt_load_store_addr_ops (gimple st ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data); } } + else if (visit_addr + && gimple_code (stmt) == GIMPLE_GOTO) + { + tree op = gimple_goto_dest (stmt); + if (TREE_CODE (op) == ADDR_EXPR) + ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data); + } return ret; } --- gcc/testsuite/gcc.c-torture/compile/pr58164.c.jj 2013-08-15 15:24:04.117313781 +0200 +++ gcc/testsuite/gcc.c-torture/compile/pr58164.c 2013-08-15 15:23:47.000000000 +0200 @@ -0,0 +1,8 @@ +/* PR tree-optimization/58164 */ + +int +foo (void) +{ + int x = 0; + goto *&x; +}