https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126316

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |12.1.0
     Ever confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2026-07-18

--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
The problem is there is a call to insert_clobbers_for_var which finds the 

ccp1 does:
  saved_stack.5_4 = __builtin_stack_save ();
  saved_stack.2_5 = __builtin_stack_save ();
  vla2.7 ={v} {CLOBBER(eos)};
  __builtin_stack_restore (saved_stack.2_5);
  vla2.4_7 = &vla2.7;
  doNothing (vla2.4_7);
  __builtin_stack_restore (saved_stack.5_4);

Which is wrong. Because it inserts the clobber at the one before the usage.
It should have skipped the saved_stack.2_5 save/restore.


So what insert_clobbers_for_var needs to do is when it reaches a
__builtin_stack_restore, mark that argument as needing to skipped and then go
to the next previous statement. And then when looking at __builtin_stack_save,
skip the ones the marked as needing to be skipped.

Reply via email to