FAIL ./check.t:arith-ternary-prec-1 with GCC >= 6.3 and LTO
Bug #1709716 reported by
Jan Palus
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mksh |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Not really sure where the issue is, whether it's mksh or gcc, but I'll try here first.
Since GCC 6.3 (also present in 6.4, didn't check 7.x) I get reproducible failure in tests if mksh was built with LTO:
sh ./Build.sh -c lto
...
./tests.sh
...
FAIL ./check.
Description:
Check precedence of ternary operator vs assignment
unexpected exit status 0 (exit-code 0), expected e != 0
unexpected stderr - wanted pattern:
/.*:.*1 \? 20 : x\+=2.*lvalue.*\n$/
got nothing
If I run input from test:
typeset -i x=2
y=$((1 ? 20 : x+=2))
the value of y is 22.
To post a comment you must log in.
It’s known that mksh’s testsuite exhibits problems in the infrastructure (kernel, libraries, toolchain, compiler).
In this case, GCC’s LTO (and before that, -fwhole-program --combine) is a repeat offender of breaking code.
If your builds exhibit this problem, you should *disable LTO for your _entire_ operating system*. (I’ve seen this GCC version produce LTO bugs on other distros as well, it’s wrong code generation, but LTO bugs are not interesting to GCC developers.)