[Bug target/105445] New: miscompile on ia64 with -foptimize-sibling-calls
matoro_gcc_bugzilla at matoro dot tk
gcc-bugzilla@gcc.gnu.org
Sun May 1 06:26:43 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105445
Bug ID: 105445
Summary: miscompile on ia64 with -foptimize-sibling-calls
Product: gcc
Version: 11.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: matoro_gcc_bugzilla at matoro dot tk
Target Milestone: ---
On ia64, the berkeleydb python module (
https://www.jcea.es/programacion/pybsddb.htm ,
https://pypi.org/project/berkeleydb/ ) is generating code that triggers a
SIGILL during unit tests with -O2. The code does not crash with -O2
-fno-optimize-sibling-calls. I apologize for not having a minimized test case.
Preprocessed source is attached though.
GCC details:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/ia64-unknown-linux-gnu/11.3.0/lto-wrapper
Target: ia64-unknown-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-11.3.0/work/gcc-11.3.0/configure
--host=ia64-unknown-linux-gnu --build=ia64-unknown-linux-gnu --prefix=/usr
--bindir=/usr/ia64-unknown-linux-gnu/gcc-bin/11.3.0
--includedir=/usr/lib/gcc/ia64-unknown-linux-gnu/11.3.0/include
--datadir=/usr/share/gcc-data/ia64-unknown-linux-gnu/11.3.0
--mandir=/usr/share/gcc-data/ia64-unknown-linux-gnu/11.3.0/man
--infodir=/usr/share/gcc-data/ia64-unknown-linux-gnu/11.3.0/info
--with-gxx-include-dir=/usr/lib/gcc/ia64-unknown-linux-gnu/11.3.0/include/g++-v11
--with-python-dir=/share/gcc-data/ia64-unknown-linux-gnu/11.3.0/python
--enable-languages=c,c++,go --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=release
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 11.3.0 p4'
--disable-esp --enable-libstdcxx-time --disable-libstdcxx-pch --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--disable-multilib --disable-fixed-point --enable-libgomp --disable-libssp
--disable-libada --disable-cet --disable-systemtap
--disable-valgrind-annotations --disable-vtable-verify --disable-libvtv
--without-zstd --enable-lto --with-isl --disable-isl-version-check
--disable-libsanitizer --enable-default-pie --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.3.0 (Gentoo 11.3.0 p4)
Backtrace during crash:
test02_basicPost32 (tests.test_queue.SimpleQueueTestCase) ...
Program received signal SIGILL, Illegal instruction.
0x200000000161ab01 in DB_consume_wait () from
/var/tmp/portage/dev-python/berkeleydb-18.1.5/work/berkeleydb-18.1.5-python3_10/build/lib/berkeleydb/_berkeleydb.cpython-310-ia64-linux-gnu.so
(gdb) bt
#0 0x200000000161ab01 in DB_consume_wait () from
/var/tmp/portage/dev-python/berkeleydb-18.1.5/work/berkeleydb-18.1.5-python3_10/build/lib/berkeleydb/_berkeleydb.cpython-310-ia64-linux-gnu.so
#1 0x20000000001f9800 in method_vectorcall_VARARGS_KEYWORDS
(func=<method_descriptor at remote 0x200000000143aed0>, args=<optimized out>,
nargsf=<optimized out>, kwnames=<optimized out>)
at ./Include/internal/pycore_ceval.h:100
#2 0x20000000001e11a0 in _PyObject_VectorcallTstate (kwnames=<optimized out>,
nargsf=<optimized out>, args=<optimized out>, callable=<optimized out>,
tstate=<optimized out>)
at ./Include/cpython/abstract.h:114
#3 PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>,
args=<optimized out>, callable=<optimized out>) at
./Include/cpython/abstract.h:123
#4 call_function (tstate=<optimized out>, trace_info=<optimized out>,
pp_stack=0x60000fffffff7f98, oparg=<optimized out>, kwnames=0x0) at
Python/ceval.c:5867
#5 0x20000000001c7670 in _PyEval_EvalFrameDefault (tstate=0x2000000800032250,
f=Frame 0x20000000013f1590, for file
/var/tmp/portage/dev-python/berkeleydb-18.1.5/work/berkeleydb-18.1.5-python3_10/tests/test_queue.py,
line 142, in test02_basicPost32
(self=<SimpleQueueTestCase(_testMethodName='test02_basicPost32',
_outcome=<_Outcome(expecting_failure=False,
result=<ImmediateTestResult(failfast=False, failures=[], errors=[], testsRun=1,
skipped=[], expectedFailures=[], unexpectedSuccesses=[], shouldStop=False,
buffer=False, tb_locals=False, _stdout_buffer=None, _stderr_buffer=None,
_original_stdout=<_io.TextIOWrapper at remote 0x2000000000fb1080>,
_original_stderr=<_io.TextIOWrapper at remote 0x2000000000fb1150>,
_mirrorOutput=False, stream=<_WritelnDecorator(stream=<_io.TextIOWrapper at
remote 0x2000000000fb1150>) at remote 0x20000000013979d0>, showAll=True,
dots=False, descriptions=True, _debug=False, _progress=False,
_progressWithNames=False, _count=1, _testRunEntered=True,
_moduleSetUpFailed=False, _previousTestClass=<type at remote
0x20000008003347e0>, _time=<float at remote 0x200000000...(truncated),
throwflag=<optimized out>) at Python/ceval.c:4202
#6 0x0000000000000000 in ?? ()
Bad codegen:
000000000002ab00 <DB_consume_wait>:
2ab00: 09 00 00 00 01 00 [MMI] nop.m 0x0
2ab06: 30 2a 00 00 48 00 mov r35=5
2ab0c: 00 00 04 00 nop.i 0x0;;
2ab10: 11 10 10 00 80 05 [MIB] alloc r2=ar.pfs,4,0,0
2ab16: 00 00 00 02 00 00 nop.i 0x0
2ab1c: 38 f7 ff 48 br.many 2a240
<_DB_consume>;;
2ab20: 0d 00 00 00 01 00 [MFI] nop.m 0x0
2ab26: 00 00 00 00 00 00 break.f 0x0
2ab2c: 00 00 04 00 nop.i 0x0;;
2ab30: 08 00 00 00 01 00 [MMI] nop.m 0x0
2ab36: 00 00 00 02 00 00 nop.m 0x0
2ab3c: 00 00 04 00 nop.i 0x0
Good codegen:
000000000002ad00 <DB_consume_wait>:
2ad00: 08 20 29 0c 80 05 [MMI] alloc r36=ar.pfs,10,6,0
2ad06: 50 02 04 00 42 60 mov r37=r1
2ad0c: 04 00 c4 00 mov r35=b0
2ad10: 09 30 01 40 00 21 [MMI] mov r38=r32
2ad16: 70 02 84 00 42 00 mov r39=r33
2ad1c: 05 10 01 84 mov r40=r34;;
2ad20: 11 48 15 00 00 24 [MIB] mov r41=5
2ad26: 00 00 00 02 00 00 nop.i 0x0
2ad2c: 28 f7 ff 58 br.call.sptk.many b0=2a440
<_DB_consume>;;
2ad30: 09 08 00 4a 00 21 [MMI] mov r1=r37
2ad36: 00 00 00 02 00 00 nop.m 0x0
2ad3c: 30 0a 00 07 mov b0=r35;;
2ad40: 11 00 00 00 01 00 [MIB] nop.m 0x0
2ad46: 00 20 01 55 00 80 mov.i ar.pfs=r36
2ad4c: 08 00 84 00 br.ret.sptk.many b0;;
2ad50: 08 00 00 00 01 00 [MMI] nop.m 0x0
2ad56: 00 00 00 02 00 00 nop.m 0x0
2ad5c: 00 00 04 00 nop.i 0x0
2ad60: 08 00 00 00 01 00 [MMI] nop.m 0x0
2ad66: 00 00 00 02 00 00 nop.m 0x0
2ad6c: 00 00 04 00 nop.i 0x0
2ad70: 08 00 00 00 01 00 [MMI] nop.m 0x0
2ad76: 00 00 00 02 00 00 nop.m 0x0
2ad7c: 00 00 04 00 nop.i 0x0
More information about the Gcc-bugs
mailing list