Issue 141928
Summary aarch64 specific misscompilation with TBAA
Labels backend:AArch64
Assignees
Reporter tblah
    This issue relates to https://github.com/llvm/llvm-project/pull/139682, which had to be reverted due to a misscompilation which was only reproducible on aarch64. That patch causes flang to emit more specific TBAA information about local variables. The pull request passed a large number of other tests on aarch64.

The misscompilation is for https://github.com/fujitsu/compiler-test-suite/blob/main/Fortran/0614/0614_0005.f. Without the patch, that program outputs
```
*** ok ***
```

With the patch (and `-O2` or above) the program emits
```
*** ng ***
3 5 7 9 11 13 15 17 19 10 13 14 15 16 17 18 19 20 11 11
```

It can be built using `flang 0614_0005.f -O3`. Alternately, here is the generated LLVMIR:
[llvm-ir.txt](https://github.com/user-attachments/files/20503379/llvm-ir.txt) (in .txt because github doesn't allow .ll).

`flang bug.ll -O3 -o /tmp/out` (flang has to be used so that the correct runtime libraries are linked).

This is reproducible with [the original patch](https://github.com/llvm/llvm-project/commit/cf16c97bfa1416672d8990862369e86f360aa11e) and with that patch cherry-picked onto current main (6602bfa721889).

I don't see any change to the LLVM IR produced by `opt -O3` with and without this patch (other than the changes to the tbaa tags) and this does not reproduce on X86, and so I think this could be an aarch64-specific misscompilation rather than a flang bug.

CC: @DominikAdamski 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to