This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29809] [4.1 Regression] Segmentation fault with 4.1.1 and 4.1-20061110
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Nov 2006 14:46:54 -0000
- Subject: [Bug c++/29809] [4.1 Regression] Segmentation fault with 4.1.1 and 4.1-20061110
- References: <bug-29809-13550@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from rguenth at gcc dot gnu dot org 2006-11-12 14:46 -------
TREE_ADDRESSABLE is missing on D.1854 in
# start_dateD.1966_53 = V_MAY_DEF <start_dateD.1966_31>;
# SFT.44D.1986_54 = V_MAY_DEF <SFT.44D.1986_12>;
# SFT.45D.1987_55 = V_MAY_DEF <SFT.45D.1987_13>;
# SFT.48D.1990_56 = V_MAY_DEF <SFT.48D.1990_17>;
# SFT.50D.1992_57 = V_MAY_DEF <SFT.50D.1992_24>;
# SFT.55D.1997_58 = V_MAY_DEF <SFT.55D.1997_41>;
# SFT.56D.1998_59 = V_MAY_DEF <SFT.56D.1998_40>;
__comp_ctor (&D.1854, &start_dateD.1966, &stop_timeD.1963)
right after running the first alias pass. This is from the inliner
replacing
__comp_ctor (&<retval>, &start_date, &stop_time);
<retval> with D.1854 here.
It looks we simply forget to mark the decl addressable during inline
substitution here:
/* Variable substitution need not be simple. In particular, the
INDIRECT_REF substitution above. Make sure that TREE_CONSTANT
and friends are up-to-date. */
else if (TREE_CODE (*tp) == ADDR_EXPR)
{
walk_tree (&TREE_OPERAND (*tp, 0), copy_body_r, id, NULL);
/* Handle the case where we substituted an INDIRECT_REF
into the operand of the ADDR_EXPR. */
if (TREE_CODE (TREE_OPERAND (*tp, 0)) == INDIRECT_REF)
*tp = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0);
else
recompute_tree_invarant_for_addr_expr (*tp);
*walk_subtrees = 0;
}
or it should have been marked addressable earlier. That we don't hit
this more often and that trunk doesn't have the problem hints at that
the following is not the right fix?
Index: tree-inline.c
===================================================================
*** tree-inline.c (revision 118723)
--- tree-inline.c (working copy)
*************** copy_body_r (tree *tp, int *walk_subtree
*** 714,720 ****
if (TREE_CODE (TREE_OPERAND (*tp, 0)) == INDIRECT_REF)
*tp = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0);
else
! recompute_tree_invarant_for_addr_expr (*tp);
*walk_subtrees = 0;
}
}
--- 714,724 ----
if (TREE_CODE (TREE_OPERAND (*tp, 0)) == INDIRECT_REF)
*tp = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0);
else
! {
! recompute_tree_invarant_for_addr_expr (*tp);
! if (DECL_P (TREE_OPERAND (*tp, 0)))
! TREE_ADDRESSABLE (TREE_OPERAND (*tp, 0)) = 1;
! }
*walk_subtrees = 0;
}
}
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29809