[llvm] [ARM] Stop gluing FP comparisons to FMSTAT (PR #116676)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 21 01:21:21 PST 2024
mstorsjo wrote:
This change caused miscompilations (crashes due to illegal instruction) at runtime. It can also be observed as failed asserts if compiling to assembly output, like this:
```c
double a, b;
double c() {
double d = a = b;
if (d)
a = -b;
a = c();
if (d)
a = -a;
return a;
}
```
```console
$ clang -target armv7-linux-gnueabihf -S repro.c -O2
clang: ../lib/Target/ARM/MCTargetDesc/ARMInstPrinter.cpp:1296: void llvm::ARMInstPrinter::printT2AddrModeImm8s4Operand(const llvm::MCInst*, unsigned int, const
llvm::MCSubtargetInfo&, llvm::raw_ostream&) [with bool AlwaysPrintImm0 = false]: Assertion `((OffImm & 0x3) == 0) && "Not a valid immediate!"' failed.
```
(Note that compiling with `-c` doesn't trigger any errors, while compiling with `-S` does.)
The original, non-reduced case is also available at https://martin.st/temp/lfg-preproc.c, in case this reduction misses the original use case (the original case didn't involve a function calling itself I think).
Please have a look, or revert if fixing takes a while.
https://github.com/llvm/llvm-project/pull/116676
More information about the llvm-commits
mailing list