| Issue |
175492
|
| Summary |
[Clang] Miscompilation at -O{1,2,3} on x86_64-linux-gnu with asm goto
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
iamanonymouscs
|
This program returns 0 at -O0/s and 155 at -O1/2/3
```
int a;
void b(int c) { a += c; }
void d(int c, int e) {
if (e)
b(c + 1);
__asm__ goto("jmp *%0" ::"r"(&&f) : : f);
b(c + 2);
goto g;
f:
if (c > 10)
goto h;
__asm__ goto("" : : : : f);
g:
if (c > 40)
goto i;
goto j;
h:
b(c);
__asm__ goto("" : : : : h);
i:
b(c);
__asm__ volatile("" : "=r"(a) : "0"(a));
j:
__asm__ goto("" : : : : i);
a = c;
}
int main() { d(11, 1); }
```
Compiler Explorer: https://godbolt.org/z/qK6vEsj6s
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs