| Issue |
76369
|
| Summary |
clang treats asm volatile block as a memory barrier, no-op on gcc
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
crosdahl
|
```c
int a = 0;
int main(void)
{
a = 1;
asm volatile ("");
a = 2;
return a;
}
```
gcc only generates one store, `a = 2;`, while clang keeps both. clang seems to treat `asm volatile("");` as a memory barrier, gcc doesn't. afaik, `asm volatile("" ::: "memory");` is the only thing that works on gcc.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs