Description
This issue relates to #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 (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 and with that patch cherry-picked onto current main (6602bfa).
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