From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29730 invoked by alias); 26 Apr 2011 13:08:28 -0000 Received: (qmail 29578 invoked by uid 22791); 26 Apr 2011 13:08:26 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_CF,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Apr 2011 13:08:10 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3QD89wj000791 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 26 Apr 2011 09:08:10 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3QD893c006419 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 26 Apr 2011 09:08:09 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p3QD88Dx015710 for ; Tue, 26 Apr 2011 15:08:08 +0200 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p3QD88qk015709 for gcc-patches@gcc.gnu.org; Tue, 26 Apr 2011 15:08:08 +0200 Date: Tue, 26 Apr 2011 13:59:00 -0000 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix VTA ICE after fixup_noreturn_call (PR debug/48768) Message-ID: <20110426130808.GG17079@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2011-04/txt/msg02041.txt.bz2 Hi! fixup_noreturn_call when removing LHS of a noreturn call does: /* We need to remove SSA name to avoid checking errors. All uses are dominated by the noreturn and thus will be removed afterwards. We proactively remove affected non-PHI statements to avoid fixup_cfg from trying to update them and crashing. */ if (TREE_CODE (op) == SSA_NAME) { use_operand_p use_p; imm_use_iterator iter; gimple use_stmt; bitmap_iterator bi; unsigned int bb_index; bitmap blocks = BITMAP_ALLOC (NULL); FOR_EACH_IMM_USE_STMT (use_stmt, iter, op) { if (gimple_code (use_stmt) != GIMPLE_PHI) bitmap_set_bit (blocks, gimple_bb (use_stmt)->index); else FOR_EACH_IMM_USE_ON_STMT (use_p, iter) SET_USE (use_p, error_mark_node); } which is fine because all the uses will be cleaned up RSN afterwards. Unfortunately, during the cleanup VTA triggers and tries to add DEBUG exprs, if there is a degenerate PHI which contains just error_mark_node set above unfortunately that results in DEBUG something => <<< error >>>, which isn't valid. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.6? 2011-04-26 Jakub Jelinek PR debug/48768 * tree-ssa.c (insert_debug_temp_for_var_def): If degenerate_phi_result is error_mark_node, set value to NULL. * gcc.dg/pr48768.c: New test. --- gcc/tree-ssa.c.jj 2011-04-13 10:54:49.000000000 +0200 +++ gcc/tree-ssa.c 2011-04-26 10:56:28.000000000 +0200 @@ -352,6 +352,10 @@ insert_debug_temp_for_var_def (gimple_st value = degenerate_phi_result (def_stmt); if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL)) value = NULL; + /* error_mark_node is what fixup_noreturn_call changes PHI arguments + to. */ + else if (value == error_mark_node) + value = NULL; } else if (is_gimple_assign (def_stmt)) { --- gcc/testsuite/gcc.dg/pr48768.c.jj 2011-04-26 10:58:17.000000000 +0200 +++ gcc/testsuite/gcc.dg/pr48768.c 2011-04-26 10:57:30.000000000 +0200 @@ -0,0 +1,38 @@ +/* PR debug/48768 */ +/* { dg-do compile } */ +/* { dg-options "-O -fcompare-debug" } */ + +int a, b; + +int +bar (void) +{ + int i, j = 1; + for (i = 0; i != 10; i++) + { + lab: + if (i) + { + int *k = &j; + } + else if (j) + goto lab; + } + return 1; +} + +inline int +foo (int x) +{ + unsigned int c = x; + int d = x; + if (bar ()) + for (; c; c++) + while (x >= 0) + if (foo (d) >= 0) + { + d = bar (); + a = b ? b : 1; + } + return 0; +} Jakub