void abort (void);
void __attribute__((regparm(1))) g (int *p)
if (*p != 1)
int main ()
k = 1;
asm volatile ("call g" :: "a" (&k));
This code is invalid, for one you should not do a call in inline-asm.
Second the store to k is dead as the inline-asm is not told that k is accessed.
asm volatile ("call g" :: "a" (&k), "m" (k)); will fix the DCE issue but the code is still invalid because
Another way to fix this is to add that this inline-asm clobers memory, aka:
asm volatile ("call g" :: "a" (&k):"memory");
Not invalid. The asm is a pointer escape point.
Is an asm a pointer escape point even if it does not have a memory clobber
Good point. You've got to indicate that you touch memory in some way in order
to force the compiler to make memory consistent before the asm.
*** Bug 24146 has been marked as a duplicate of this bug. ***