Issue 110251
Summary asm goto wrong output at `-O0`
Labels new issue
Assignees
Reporter fuhsnn
    Godbolt: https://godbolt.org/z/3a1vYMaoq
```
void asm_goto_output(int *arg) {
  asm goto (
    "  subl $11, %[value];"
    "  cmpl $11, %[value]; je %l[label];"
    : [value]"+r"(*arg)
    :
    : "cc"
    : label
    );
  label:
  return;
}

int main(void) {
  int i = 22;
  asm_goto_output(&i);
  return i;
}
```
The output should be `11`, yet clang at `-O0` stores `0` to the pointed-to variable.

Looks like only the jump branch is buggy, if input is changed to another value and the fall-through path is taken, the output is correct.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to