[Bug tree-optimization/33434] [4.3 Regression] inlining miscompilation
hubicka at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Nov 8 12:42:00 GMT 2007
------- Comment #15 from hubicka at gcc dot gnu dot org 2007-11-08 12:42 -------
The problem here is that code assumes that variable without DEFAULT_DEF is not
in SSA. Arguments that are unused also do have DEFAULT_DEF=NULL, this patch
should fix it. I am testing it now.
Honza
Index: tree-inline.c
===================================================================
*** tree-inline.c (revision 129992)
--- tree-inline.c (working copy)
*************** setup_one_parameter (copy_body_data *id,
*** 1420,1425 ****
--- 1420,1434 ----
&& !useless_type_conversion_p (TREE_TYPE (p), TREE_TYPE (value)))
rhs = fold_build1 (NOP_EXPR, TREE_TYPE (p), value);
+ /* If the value of argument is never used, don't care about initializing
it.
+ This is needed for correctness since we otherwise confuse it with
non-SSA
+ variable later and end up renaming otherwise. */
+ if (gimple_in_ssa_p (cfun) && is_gimple_reg (p) && !def)
+ {
+ gcc_assert (!TREE_SIDE_EFFECTS (value));
+ return;
+ }
+
/* If the parameter is never assigned to, has no SSA_NAMEs created,
we may not need to create a new variable here at all. Instead, we may
be able to just use the argument value. */
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33434
More information about the Gcc-bugs
mailing list