https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122058
Bug ID: 122058
Summary: [16 regression] ICU miscompiled with -O2 -flto
-fno-semantic-interposition since
r16-4000-g9ee937b2f92a93
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: lto, needs-bisection, needs-source, wrong-code
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
Target Milestone: ---
I'm filing this as a semi-placeholder, I won't have a chance to work on it more
until post-Cauldron.
ICU is miscompiled with -O2 -flto -fno-semantic-interposition since
r16-4000-g9ee937b2f92a93. If I cherry-pick r16-4000-g9ee937b2f92a93 back, 10
works and >=11 fails. I haven't bisected between 10 and 11 yet.
With icu-77.1:
```
~/bugs/icu/icu/source/build $ cat test.sh
#!/bin/bash
set -x
set -e
export CC="gcc"
export CXX="g++"
export CFLAGS="-O2 -ggdb3 -flto=auto -fno-semantic-interposition"
export CXXFLAGS="-O2 -ggdb3 -flto=auto -fno-semantic-interposition"
../configure \
--disable-renaming \
--disable-layoutex \
--disable-samples
make -j$(nproc)
make -j$(nproc) check
#cd test/intltest
#LD_LIBRARY_PATH=../../lib:../../stubdata:../../tools/ctestfw:$LD_LIBRARY_PATH
./intltest \
#
"-E/home/sam/bugs/icu/icu/source/build/test/tmp/status.2853710.deleteme.intltest"
\
# /NumberTest/NumberRangeFormatterTest/testPlurals
```
shows it for me.
If I modify the test to abort for easier debugging:
```
$ LD_LIBRARY_PATH=../../lib:../../stubdata:../../tools/ctestfw:$LD_LIBRARY_PATH
gdb --args ./intltest
"-E/home/sam/bugs/icu/icu/source/build/test/tmp/status.2853710.deleteme.intltest"
/NumberTest/NumberRangeFormatterTest/testPlurals
Reading symbols from ./intltest...
(gdb) r
Starting program: /home/sam/bugs/icu/icu/source/build/test/intltest/intltest
-E/home/sam/bugs/icu/icu/source/build/test/tmp/status.2853710.deleteme.intltest
/NumberTest/NumberRangeFormat
terTest/testPlurals
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
-----------------------------------------------
IntlTest (C++) Test Suite for
International Components for Unicode 77.1
Bits: 64, Byte order: Little endian, Chars: ASCII
-----------------------------------------------
Options:
all (a) : Off
Verbose (v) : Off
No error messages (n) : Off
Exhaustive (e) : Off
Leaks (l) : Off
utf-8 (u) : Off
notime (T) : Off
noknownissues (K) : Off
Warn on missing data (w) : Off
Write golden data (G) : Off
Threads : 12
-----------------------------------------------
=== Handling test: /NumberTest/NumberRangeFormatterTest/testPlurals: ===
utility {
} OK: utility
normalize {
} OK: normalize
collate {
} OK: collate
regex {
} OK: regex
format {
NumberTest {
NumberRangeFormatterTest {
testPlurals {
FAIL: 1 1; got "1\u20131 britanska funta"; expected "1\u20131
britanski funti"
Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at
pthread_kill.c:44
44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO
(ret) : 0;
(gdb) bt
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0)
at pthread_kill.c:44
#1 __pthread_kill_internal (threadid=<optimized out>, signo=6) at
pthread_kill.c:89
#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at
pthread_kill.c:100
#3 0x00007ffff4e20fa2 in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
#4 0x00007ffff4e013a1 in __GI_abort () at abort.c:77
#5 0x000055555571a221 in IntlTest::assertEquals (this=0x7fffffff54b0,
message=<optimized out>, expected=..., actual=..., possibleDataError=0 '\000')
at ../../../test/intltest/intltest.cpp:2049
#6 0x0000555555b63d1b in IntlTest::assertEquals (possibleDataError=0 '\000',
this=<optimized out>, message=..., expected=u"1–1 britanski funti",
actual=u"1–1 britanska funta")
at ../../../test/intltest/intltest.cpp:2345
#7 NumberRangeFormatterTest::testPlurals (this=0x7fffffff54b0) at
../../../test/intltest/numbertest_range.cpp:755
#8 0x000055555570ff3b in IntlTest::runTestLoop (this=0x7fffffff54b0,
testname=0x7fffffffdb29 "testPlurals", par=0x0,
baseName=0x7fffffff54e8
"//NumberTest/NumberRangeFormatterTest/testPlurals/NumberTest/NumberRangeFormatterTest/testPlurals/")
at ../../../test/intltest/intltest.cpp:811
#9 0x000055555570fc50 in IntlTest::runTest (this=0x7fffffff54b0,
name=0x7fffffffdb29 "testPlurals", par=<optimized out>,
baseName=0x7fffffff54e8
"//NumberTest/NumberRangeFormatterTest/testPlurals/NumberTest/NumberRangeFormatterTest/testPlurals/")
at ../../../test/intltest/intltest.cpp:739
#10 0x0000555555721acc in IntlTest::callTest (this=0x7fffffff8340,
testToBeCalled=..., par=0x0) at ../../../test/intltest/intltest.cpp:633
#11 NumberTest::runIndexedTest (this=0x7fffffff8340, index=<optimized out>,
exec=<optimized out>, name=<optimized out>, par=0x0) at
../../../test/intltest/numbertest.h:424
#12 0x000055555570ff3b in IntlTest::runTestLoop (this=0x7fffffff8340,
testname=0x7fffffffdb10 "NumberRangeFormatterTest", par=0x0,
baseName=0x7fffffff8378
"//NumberTest/NumberRangeFormatterTest/testPlurals/NumberTest/NumberRangeFormatterTest/")
at ../../../test/intltest/intltest.cpp:811
#13 0x000055555570fc50 in IntlTest::runTest (this=0x7fffffff8340,
name=0x7fffffffdb10 "NumberRangeFormatterTest", par=<optimized out>,
baseName=0x7fffffff8378
"//NumberTest/NumberRangeFormatterTest/testPlurals/NumberTest/NumberRangeFormatterTest/")
at ../../../test/intltest/intltest.cpp:739
#14 0x00005555557288b4 in IntlTest::callTest (this=0x7fffffff9670,
testToBeCalled=..., par=0x0) at ../../../test/intltest/intltest.cpp:633
#15 IntlTestFormat::runIndexedTest (this=0x7fffffff9670, index=<optimized out>,
exec=<optimized out>, name=@0x7fffffff9368: 0x555555cafa9d "NumberTest",
par=0x0)
at ../../../test/intltest/itformat.cpp:226
#16 0x000055555570ff3b in IntlTest::runTestLoop (this=0x7fffffff9670,
testname=0x7fffffffdb05 "NumberTest", par=0x0,
baseName=0x7fffffff96a8
"//NumberTest/NumberRangeFormatterTest/testPlurals/NumberTest/") at
../../../test/intltest/intltest.cpp:811
#17 0x000055555570fc50 in IntlTest::runTest (this=0x7fffffff9670,
name=0x7fffffffdb05 "NumberTest", par=<optimized out>,
baseName=0x7fffffff96a8
"//NumberTest/NumberRangeFormatterTest/testPlurals/NumberTest/") at
../../../test/intltest/intltest.cpp:739
#18 0x0000555555725591 in IntlTest::callTest (this=0x7fffffffa530,
testToBeCalled=..., par=0x0) at ../../../test/intltest/intltest.cpp:633
#19 MajorTestLevel::runIndexedTest (this=0x7fffffffa530, index=<optimized out>,
exec=<optimized out>, name=<optimized out>, par=0x0) at
../../../test/intltest/itmajor.cpp:98
#20 0x000055555570ff3b in IntlTest::runTestLoop (this=0x7fffffffa530,
testname=0x0, par=0x0, baseName=0x7fffffffae00
"//NumberTest/NumberRangeFormatterTest/testPlurals/format/")
at ../../../test/intltest/intltest.cpp:811
#21 0x000055555570fbb1 in IntlTest::runTest (this=this@entry=0x7fffffffa530,
name=name@entry=0x7fffffffdb04 "", par=par@entry=0x0,
baseName=baseName@entry=0x7fffffffae00
"//NumberTest/NumberRangeFormatterTest/testPlurals/format/") at
../../../test/intltest/intltest.cpp:732
#22 0x000055555561edb7 in main (argc=3, argv=0x7fffffffd668) at
../../../test/intltest/intltest.cpp:1538
```