https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105459
Bug ID: 105459
Summary: ICE: Segmentation fault (in record_operand_costs)
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: asolokha at gmx dot com
Target Milestone: ---
gcc 12.0.1 20220424 snapshot (g:6b7441a46c771aa6ecdc0c8ed96197417d036b9a) ICEs
when compiling the following testcase w/ -O1 -flto:
double m;
int n;
__attribute__ ((optimize ("-funsafe-math-optimizations"))) void
bar (int x)
{
n = x;
m = n;
}
__attribute__ ((flatten)) void
foo (int x)
{
bar (x);
}
void
quux (void)
{
++n;
}
int
main (void)
{
foo (0);
quux ();
return 0;
}
% x86_64-unknown-linux-gnu-gcc-12.0.1 -O1 -flto qnipdldf.c
during RTL pass: ira
qnipdldf.c: In function 'main':
qnipdldf.c:30:1: internal compiler error: Segmentation fault
30 | }
| ^
0xd95abf crash_signal
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220424/work/gcc-12-20220424/gcc/toplev.cc:322
0xbabeb8 record_operand_costs
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220424/work/gcc-12-20220424/gcc/ira-costs.cc:1382
0xbac464 scan_one_insn
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220424/work/gcc-12-20220424/gcc/ira-costs.cc:1507
0xbac464 process_bb_for_costs
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220424/work/gcc-12-20220424/gcc/ira-costs.cc:1632
0xba2ae1 ira_traverse_loop_tree(bool, ira_loop_tree_node*, void
(*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*))
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220424/work/gcc-12-20220424/gcc/ira-build.cc:1800
0xbad545 find_costs_and_classes
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220424/work/gcc-12-20220424/gcc/ira-costs.cc:1728
0xbae639 ira_costs()
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220424/work/gcc-12-20220424/gcc/ira-costs.cc:2276
0xba806c ira_build()
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220424/work/gcc-12-20220424/gcc/ira-build.cc:3481
0xb9dd0c ira
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220424/work/gcc-12-20220424/gcc/ira.cc:5760
0xb9dd0c execute
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220424/work/gcc-12-20220424/gcc/ira.cc:6083
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: x86_64-unknown-linux-gnu-gcc-12.0.1 returned 1 exit
status
compilation terminated.
/usr/lib/gcc/x86_64-unknown-linux-gnu/12.0.1/../../../../x86_64-unknown-linux-gnu/bin/ld:
fatal error: lto-wrapper failed