From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60333 invoked by alias); 12 May 2015 13:24:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 60324 invoked by uid 89); 12 May 2015 13:24:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Tue, 12 May 2015 13:24:46 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 36B7CAD4C for ; Tue, 12 May 2015 13:24:43 +0000 (UTC) Date: Tue, 12 May 2015 13:42:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR66101 Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2015-05/txt/msg01079.txt.bz2 This fixes PR66101. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2015-05-12 Richard Biener PR tree-optimization/66101 * tree-ssa-dce.c (remove_dead_stmt): Properly mark loops for fixup if we turn a loop exit edge to a fallthru edge. * gcc.dg/torture/pr66101.c: New testcase. Index: gcc/tree-ssa-dce.c =================================================================== *** gcc/tree-ssa-dce.c (revision 223044) --- gcc/tree-ssa-dce.c (working copy) *************** remove_dead_stmt (gimple_stmt_iterator * *** 1149,1155 **** if (e != e2) { cfg_altered = true; ! remove_edge (e2); } else ei_next (&ei); --- 1149,1160 ---- if (e != e2) { cfg_altered = true; ! /* If we made a BB unconditionally exit a loop then this ! transform alters the set of BBs in the loop. Schedule ! a fixup. */ ! if (loop_exit_edge_p (bb->loop_father, e)) ! loops_state_set (LOOPS_NEED_FIXUP); ! remove_edge (e2); } else ei_next (&ei); Index: gcc/testsuite/gcc.dg/torture/pr66101.c =================================================================== *** gcc/testsuite/gcc.dg/torture/pr66101.c (revision 0) --- gcc/testsuite/gcc.dg/torture/pr66101.c (working copy) *************** *** 0 **** --- 1,35 ---- + /* { dg-do compile } */ + + #include + + jmp_buf env; + + int a, c, d, e; + + int + bar () + { + int b = *(long *) 7 == 5 ? : 0; + if (a || a > b) + longjmp (env, 0); + return 1; + } + + void + foo () + { + long f; + setjmp (env); + for (; d; c++) + switch (c) + case 0: + { + f = bar () >> 1; + if (e) + goto L; + if (bar () >> 1) + goto L; + } + L: + ; + }