https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94762
Bug ID: 94762
Summary: ICE: Segmentation fault (in is_tm_irrevocable)
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code, trans-mem
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: asolokha at gmx dot com
CC: marxin at gcc dot gnu.org
Target Milestone: ---
Target: x86_64-unknown-linux-gnu
gcc-10.0.1-alpha20200419 snapshot (g:717e91dbc44c6bf55a498f45f6045191ceb10a11),
gcc 9.3, gcc 8.3, gcc 7.3 all ICE when compiling the following testcase,
reduced from
test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
from the libcxx 10.0.0 test suite, w/ -O1 -fgnu-tm:
_Bool __attribute__ ((transaction_safe))
g5 (int fh, int gf)
{
return __atomic_compare_exchange_n (&fh, &gf, 0, 0, 0, 0);
}
% x86_64-unknown-linux-gnu-gcc-10.0.1 -O1 -fgnu-tm -c gl8a6jtn.c
during IPA pass: tmipa
gl8a6jtn.c: In function 'g5':
gl8a6jtn.c:5:1: internal compiler error: Segmentation fault
5 | }
| ^
0xd9466f crash_signal
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200419/work/gcc-10-20200419/gcc/toplev.c:328
0xd9a5e0 is_tm_irrevocable
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200419/work/gcc-10-20200419/gcc/trans-mem.c:234
0xd9c20f ipa_tm_scan_irr_block
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200419/work/gcc-10-20200419/gcc/trans-mem.c:4377
0xd9c20f ipa_tm_scan_irr_blocks
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200419/work/gcc-10-20200419/gcc/trans-mem.c:4449
0xd9c9b5 ipa_tm_scan_irr_function
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200419/work/gcc-10-20200419/gcc/trans-mem.c:4611
0xd9ea1e ipa_tm_execute
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200419/work/gcc-10-20200419/gcc/trans-mem.c:5512
0xd9ea1e execute
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200419/work/gcc-10-20200419/gcc/trans-mem.c:5670
Citing Jakub's PR94106 comment 2: "Nobody really maintains the -fgnu-tm stuff
anymore".
I didn't test it but it looks like Marek's patch from PR68122 comment 8, even
if is not a right fix, works this ICE around.