This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/33434] [4.3 Regression] inlining miscompilation
- From: "hubicka at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Nov 2007 12:42:29 -0000
- Subject: [Bug tree-optimization/33434] [4.3 Regression] inlining miscompilation
- References: <bug-33434-7958@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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