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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #8)
> I think simple_dce_from_worklist is incorrect of removing this inline-asm in
> the first place.
> Take:
> ```
> static int t;
> 
> int f (int *a)
> {
>   int t1;
>   asm (" " : "=r" (t1) : : "memory");
>   t = t1;
>   return *a;
> }
> ```
> The inline-asm could have written to *a but now it has been removed.

I think that is how inline asm always behaved.  If it is not ok to be DCEd when
the result is dead, one needs to use volatile keyword.

Reply via email to