https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95343
Martin Jambor <jamborm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |jamborm at gcc dot gnu.org Summary|IPA-SRA can result in bad |IPA-SRA can result in wrong |debug info about removed |debug info about removed |function arguments |function arguments Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2020-05-26 Ever confirmed|0 |1 --- Comment #1 from Martin Jambor <jamborm at gcc dot gnu.org> --- The simplest fix which will make i reported as "optimized out" is the following. But I am testing a patch which can make gdb actually show the correct 4. Still, the following is usable for gcc 10 if the full patch is deemed too risky: diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c index 978916057f0..2a04f7b3ce5 100644 --- a/gcc/ipa-param-manipulation.c +++ b/gcc/ipa-param-manipulation.c @@ -787,7 +787,12 @@ ipa_param_adjustments::modify_call (gcall *stmt, if (!is_gimple_reg (old_parm) || kept[i]) continue; tree origin = DECL_ORIGIN (old_parm); - tree arg = gimple_call_arg (stmt, i); + int index; + if (transitive_remapping) + index = index_map[i]; + else + index = i; + tree arg = gimple_call_arg (stmt, index); if (!useless_type_conversion_p (TREE_TYPE (origin), TREE_TYPE (arg))) {