From patchwork Mon Sep 30 07:36:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 278934 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 did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4BCCF2C00B9 for ; Mon, 30 Sep 2013 17:36:26 +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:subject:message-id:mime-version:content-type; q=dns; s= default; b=XdFvGRTlsxQsoV2iTu/vcjway0Iazd1DvIDeKqsJcyFTVjRRwgWNC HISab1/CH01ECeWnCbMGxoTv2/CyVltq5I/5p31aHeS277Y9zwlrQZdbok+6a55A cjE/+JIaR2m7FuAJ9L9sH/fxd0RcMLTa7P0s1sP0EFXEswuqvzy0k4= 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:subject:message-id:mime-version:content-type; s= default; bh=s2nGHxHtjORiVrQhZzW+goV0FkY=; b=tbX4visRdhhM90II1IHk GMBVaAq3SKgqx2Ki2mAtvnc8y2l97U8QV1nPTM2aUOk+aQKGN6HwRVdo+plBoEWs jGVp10TaCd7dKuE15j32xgOEy64Hpjf7FHTF2mhShfcyATzYiWKqSCsO/UFemSbU lkyVCU36URepbxZmk9b96D8= Received: (qmail 12671 invoked by alias); 30 Sep 2013 07:36:20 -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 12653 invoked by uid 89); 30 Sep 2013 07:36:19 -0000 Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Sep 2013 07:36:19 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, RDNS_NONE autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 353A5A398F for ; Mon, 30 Sep 2013 09:36:17 +0200 (CEST) Date: Mon, 30 Sep 2013 09:36:16 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR58532 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 This fixes PR58532, a bootstrap-debug issue with -O3. Debug stmts got in the way of adding abnormal edges during inlining. Bootstrapped on x86_64-unkown-linux-gnu (with -O3 and default flags), committed to trunk. Richard. 2013-09-30 Richard Biener PR middle-end/58532 * tree-cfg.c (make_abnormal_goto_edges): Skip debug statements before looking for setjmp-like calls. * g++.dg/torture/pr58552.C: New testcase. Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c (revision 202971) +++ gcc/tree-cfg.c (working copy) @@ -1013,6 +1013,9 @@ make_abnormal_goto_edges (basic_block bb break; } } + if (!gsi_end_p (gsi) + && is_gimple_debug (gsi_stmt (gsi))) + gsi_next_nondebug (&gsi); if (!gsi_end_p (gsi)) { /* Make an edge to every setjmp-like call. */ Index: gcc/testsuite/g++.dg/torture/pr58552.C =================================================================== --- gcc/testsuite/g++.dg/torture/pr58552.C (revision 0) +++ gcc/testsuite/g++.dg/torture/pr58552.C (working copy) @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-additional-options "-fcompare-debug" } + +extern void fancy_abort () __attribute__ ((__noreturn__)); +extern "C" { + struct __jmp_buf_tag { }; + typedef struct __jmp_buf_tag jmp_buf[1]; + extern int _setjmp (struct __jmp_buf_tag __env[1]) throw (); +} +extern void *gfc_state_stack; +static jmp_buf eof_buf; +static void push_state () +{ + if (!gfc_state_stack) + fancy_abort (); +} +bool gfc_parse_file (void) +{ + int seen_program=0; + if (_setjmp (eof_buf)) + return false; + if (seen_program) + goto duplicate_main; + seen_program = 1; + push_state (); + push_state (); +duplicate_main: + return true; +}