From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5524 invoked by alias); 8 Jul 2010 12:33:29 -0000 Received: (qmail 5403 invoked by uid 48); 8 Jul 2010 12:33:12 -0000 Date: Thu, 08 Jul 2010 12:33:00 -0000 Message-ID: <20100708123312.5402.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug debug/44832] [4.6 Regression] -fcompare-debug failure for C++ i386.c In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg00863.txt.bz2 ------- Comment #43 from rguenth at gcc dot gnu dot org 2010-07-08 12:33 ------- I placed a debug_generic_expr () in copy_node_stat and re-directed output ... Now, I see that in the non-debug case we are copying the LABEL_DECL while copying statements while in the debug case we are copying it while copying the block tree. We have to preserve used labels in the block tree it's just not trivial to do unless we resort to setting TREE_USED. Which would be the following, which also fixes the failure. Index: tree-ssa-live.c =================================================================== --- tree-ssa-live.c (revision 161949) +++ tree-ssa-live.c (working copy) @@ -384,6 +384,9 @@ mark_all_vars_used_1 (tree *tp, int *wal set_is_used (t); } + if (TREE_CODE (t) == LABEL_DECL) + TREE_USED (t) = true; + if (IS_TYPE_OR_DECL_P (t)) *walk_subtrees = 0; @@ -448,6 +451,13 @@ remove_unused_scope_block_p (tree scope) else if (TREE_CODE (*t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*t)) unused = false; + /* Labels that are still used in the IL we have to preserve in + the block tree as well, otherwise we risk having different + ordering in debug vs. non-debug builds during inlining + or versioning. */ + else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t)) + unused = false; + /* Remove everything we don't generate debug info for. */ else if (DECL_IGNORED_P (*t)) { we don't have var annotations for LABEL_DECLs, so a proper solution would use a bitmap of UIDs to preserve here I guess. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44832