Bug 85852 - [9 Regression] ICE: Segmentation fault (in contains_struct_check)
Summary: [9 Regression] ICE: Segmentation fault (in contains_struct_check)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: 9.0
Assignee: Richard Sandiford
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2018-05-21 04:11 UTC by Arseny Solokha
Modified: 2018-05-22 15:12 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 8.1.0
Known to fail: 9.0
Last reconfirmed: 2018-05-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2018-05-21 04:11:08 UTC
gcc-9.0.0-alpha20180520 snapshot (r260425) ICEs when compiling the following snippet w/ -mfma -O2 (-O3, -Os) -fexceptions -fnon-call-exceptions:

void
q3 (double mo)
{
  mo = (mo / 0.0) * mo - mo;
}

% gcc-9.0.0-alpha20180520 -mfma -O2 -fexceptions -fnon-call-exceptions -c hpyrkugn.c
during RTL pass: expand
hpyrkugn.c: In function 'q3':
hpyrkugn.c:4:6: internal compiler error: Segmentation fault
   mo = (mo / 0.0) * mo - mo;
   ~~~^~~~~~~~~~~~~~~~~~~~~~
0xc9b59f crash_signal
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/toplev.c:325
0xa95733 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*)
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/tree.h:3248
0xa95733 expand_direct_optab_fn
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/internal-fn.c:2894
0x87e757 expand_call_stmt
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:2598
0x87e757 expand_gimple_stmt_1
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:3644
0x87e757 expand_gimple_stmt
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:3810
0x87fd9c expand_gimple_tailcall
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:3856
0x87fd9c expand_gimple_basic_block
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:5812
0x884837 execute
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:6441

This is not target-specific and also reproduces on powerpc (w/ appropriate -mcpu) at least.
Comment 1 Arseny Solokha 2018-05-21 04:30:39 UTC
Here's a testcase w/o zero division:

void
ki (double nq)
{
  double zo = 1.1 * nq - nq;
}

% gcc-9.0.0-alpha20180520 -mfma -O2 -fexceptions -fnon-call-exceptions -c pr85852-1.c
during RTL pass: expand
pr85852-1.c: In function 'ki':
pr85852-1.c:4:10: internal compiler error: Segmentation fault
   double zo = 1.1 * nq - nq;
          ^~
0xc9b59f crash_signal
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/toplev.c:325
0xa95733 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*)
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/tree.h:3248
0xa95733 expand_direct_optab_fn
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/internal-fn.c:2894
0x87e757 expand_call_stmt
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:2598
0x87e757 expand_gimple_stmt_1
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:3644
0x87e757 expand_gimple_stmt
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:3810
0x87fd9c expand_gimple_tailcall
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:3856
0x87fd9c expand_gimple_basic_block
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:5812
0x884837 execute
	/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20180520/work/gcc-9-20180520/gcc/cfgexpand.c:6441
Comment 2 Martin Liška 2018-05-21 07:35:52 UTC
Confirmed, started with r260348.
Comment 3 Richard Sandiford 2018-05-21 19:44:36 UTC
Mine.
Comment 4 Richard Sandiford 2018-05-22 15:12:08 UTC
Fixed by r260504.  Testcase name fixed in r260536.