Bug 91334 - [10 Regression] ICE in propagate_necessity at gcc/tree-ssa-dce.c:813 since r273791
Summary: [10 Regression] ICE in propagate_necessity at gcc/tree-ssa-dce.c:813 since r2...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 10.0
: P1 normal
Target Milestone: 10.0
Assignee: Martin Liška
URL:
Keywords:
: 91350 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-08-02 21:33 UTC by H.J. Lu
Modified: 2019-08-11 14:32 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 9.1.0
Known to fail: 10.0
Last reconfirmed: 2019-08-03 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2019-08-02 21:33:04 UTC
On x86-64, when building 483.xalancbmk in SPEC CPU 2006, r273791 caused:

$ g++ -m32  -Ofast -funroll-loops -msse2 -mfpmath=sse -ffast-math -march=skylake-avx512 -flto ...
ElemNumber.cpp: In member function 'getCountString':
ElemNumber.cpp:458:1: internal compiler error: Segmentation fault
  458 | ElemNumber::getCountString(
      | ^ 
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/local/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
specmake: *** [Xalan] Error 1
Comment 1 Martin Liška 2019-08-03 07:37:55 UTC
Mine.
Comment 2 Martin Liška 2019-08-03 07:51:58 UTC
Reduced test-case:

$ cat ice.cpp
struct Base {
  virtual ~Base();
};
struct Derived : Base {
  void operator delete(void *) {}
};
void foo() { Derived d1; }

$ gcc -O3 -c -fno-ipa-pure-const -fipa-sra -fno-early-inlining ice.cpp
during GIMPLE pass: cddce
ice.cpp: In destructor ‘virtual Derived::~Derived()’:
ice.cpp:7:26: internal compiler error: in gimple_call_arg, at gimple.h:3190
    7 | void foo() { Derived d1; }
      |                          ^
0x13198ce gimple_call_arg
	/home/marxin/Programming/gcc/gcc/gimple.h:3190
0x1319924 gimple_call_arg
	/home/marxin/Programming/gcc/gcc/gimple.h:3198
0x131c76a propagate_necessity
	/home/marxin/Programming/gcc/gcc/tree-ssa-dce.c:813
0x131f0b1 perform_tree_ssa_dce
	/home/marxin/Programming/gcc/gcc/tree-ssa-dce.c:1663
0x131f1f3 tree_ssa_cd_dce
	/home/marxin/Programming/gcc/gcc/tree-ssa-dce.c:1707
0x131f360 execute
	/home/marxin/Programming/gcc/gcc/tree-ssa-dce.c:1772

I've got a patch candidate for it.
Comment 3 David Binderman 2019-08-04 08:28:14 UTC
Another way to generate the same crash is to compile file
gcc testsuite file g++.old-deja/g++.oliva/new1.C with compiler flag -O2.

during GIMPLE pass: cddce
./g++.old-deja/g++.oliva/new1.C: In function â<80><98>int main()â<80><99>:
./g++.old-deja/g++.oliva/new1.C:20:43: internal compiler error: in gimple_call_arg, at gimple.h:3190
Comment 4 Martin Liška 2019-08-05 05:04:58 UTC
*** Bug 91350 has been marked as a duplicate of this bug. ***
Comment 5 Martin Liška 2019-08-05 12:53:33 UTC
Author: marxin
Date: Mon Aug  5 12:53:01 2019
New Revision: 274115

URL: https://gcc.gnu.org/viewcvs?rev=274115&root=gcc&view=rev
Log:
Handle new operators with no arguments in DCE.

2019-08-05  Martin Liska  <mliska@suse.cz>

	PR c++/91334
	* tree-ssa-dce.c (propagate_necessity): Handle new operators
	with not arguments.
	(eliminate_unnecessary_stmts): Likewise.
2019-08-05  Martin Liska  <mliska@suse.cz>

	PR c++/91334
	* g++.dg/torture/pr91334.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr91334.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-dce.c
Comment 6 Martin Liška 2019-08-05 12:53:46 UTC
Should be fixed now.
Comment 7 H.J. Lu 2019-08-06 23:59:58 UTC
r274135 gave:

./PlatformDefinitions.hpp:66:35: internal compiler error: Segmentation fault
   66 |  #define XALAN_CPP_NAMESPACE_END  }
      |                                   ^
0xfbc09f crash_signal
	../../src-trunk/gcc/toplev.c:326
0xb26383 lookup_page_table_entry
	../../src-trunk/gcc/ggc-page.c:632
0xb26383 ggc_set_mark(void const*)
	../../src-trunk/gcc/ggc-page.c:1531
0xd69c41 gt_ggc_mx_symtab_node(void*)
	/export/gnu/import/git/gcc-test-spec-lto/bld/gcc/gtype-desc.c:1302
0xee468d gt_ggc_ma_order
	./gt-passes.h:31
0xee468d gt_ggc_ma_order
	./gt-passes.h:26
0xcf6115 ggc_mark_root_tab
	../../src-trunk/gcc/ggc-common.c:77
0xcf631c ggc_mark_roots()
	../../src-trunk/gcc/ggc-common.c:94
0xb26d05 ggc_collect()
	../../src-trunk/gcc/ggc-page.c:2201
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Comment 8 Martin Liška 2019-08-07 07:53:10 UTC
Can you please provide both compiler options used and a test-case?
Comment 9 H.J. Lu 2019-08-07 15:25:58 UTC
[hjl@gnu-mic-1 build_base_lto.0000]$ /export/gnu/import/git/gcc-test-spec-lto/usr/bin/g++ -S -DSPEC_CPU -DNDEBUG  -DAPP_NO_THREADS -DXALAN_INMEM_MSG_LOADER -I. -Ixercesc -Ixercesc/dom -Ixercesc/dom/impl -Ixercesc/sax -Ixercesc/util/MsgLoaders/InMemory -Ixercesc/util/Transcoders/Iconv -Ixalanc/include -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -O2    -DSPEC_CPU_LP64  -DSPEC_CPU_LINUX     XPath.cpp  -ffast-math
In file included from ./XPathDefinitions.hpp:21,
                 from XPath.hpp:22,
                 from XPath.cpp:18:
XPath.cpp: In member function ‘void xalanc_1_8::XPath::executeMore(xalanc_1_8::XalanNode*, xalanc_1_8::XPath::OpCodeMapPositionType, xalanc_1_8::XPathExecutionContext&, xalanc_1_8::FormatterListener&, xalanc_1_8::XPath::MemberFunctionPtr) const’:
./PlatformDefinitions.hpp:66:35: internal compiler error: Segmentation fault
   66 |  #define XALAN_CPP_NAMESPACE_END  }
      |                                   ^
XPath.cpp:5696:1: note: in expansion of macro ‘XALAN_CPP_NAMESPACE_END’
 5696 | XALAN_CPP_NAMESPACE_END
      | ^~~~~~~~~~~~~~~~~~~~~~~
0xfbcc0f crash_signal
	../../src-trunk/gcc/toplev.c:326
0xb26b73 lookup_page_table_entry
	../../src-trunk/gcc/ggc-page.c:632
0xb26b73 ggc_set_mark(void const*)
	../../src-trunk/gcc/ggc-page.c:1531
0xd6a781 gt_ggc_mx_symtab_node(void*)
	/export/gnu/import/git/gcc-test-spec-lto/bld/gcc/gtype-desc.c:1302
0xee51fd gt_ggc_ma_order
	./gt-passes.h:31
0xee51fd gt_ggc_ma_order
	./gt-passes.h:26
0xcf6995 ggc_mark_root_tab
	../../src-trunk/gcc/ggc-common.c:77
0xcf6b9c ggc_mark_roots()
	../../src-trunk/gcc/ggc-common.c:94
0xb274f5 ggc_collect()
	../../src-trunk/gcc/ggc-page.c:2201
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
[hjl@gnu-mic-1 build_base_lto.0000]$ 

-O2 -ffast-math is needed to trigger ICE.
Comment 10 Martin Liška 2019-08-08 07:14:57 UTC
(In reply to H.J. Lu from comment #9)
> [hjl@gnu-mic-1 build_base_lto.0000]$
> /export/gnu/import/git/gcc-test-spec-lto/usr/bin/g++ -S -DSPEC_CPU -DNDEBUG 
> -DAPP_NO_THREADS -DXALAN_INMEM_MSG_LOADER -I. -Ixercesc -Ixercesc/dom
> -Ixercesc/dom/impl -Ixercesc/sax -Ixercesc/util/MsgLoaders/InMemory
> -Ixercesc/util/Transcoders/Iconv -Ixalanc/include -DPROJ_XMLPARSER
> -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM
> -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER
> -O2    -DSPEC_CPU_LP64  -DSPEC_CPU_LINUX     XPath.cpp  -ffast-math
> In file included from ./XPathDefinitions.hpp:21,
>                  from XPath.hpp:22,
>                  from XPath.cpp:18:
> XPath.cpp: In member function ‘void
> xalanc_1_8::XPath::executeMore(xalanc_1_8::XalanNode*,
> xalanc_1_8::XPath::OpCodeMapPositionType,
> xalanc_1_8::XPathExecutionContext&, xalanc_1_8::FormatterListener&,
> xalanc_1_8::XPath::MemberFunctionPtr) const’:
> ./PlatformDefinitions.hpp:66:35: internal compiler error: Segmentation fault
>    66 |  #define XALAN_CPP_NAMESPACE_END  }
>       |                                   ^
> XPath.cpp:5696:1: note: in expansion of macro ‘XALAN_CPP_NAMESPACE_END’
>  5696 | XALAN_CPP_NAMESPACE_END
>       | ^~~~~~~~~~~~~~~~~~~~~~~
> 0xfbcc0f crash_signal
> 	../../src-trunk/gcc/toplev.c:326
> 0xb26b73 lookup_page_table_entry
> 	../../src-trunk/gcc/ggc-page.c:632
> 0xb26b73 ggc_set_mark(void const*)
> 	../../src-trunk/gcc/ggc-page.c:1531
> 0xd6a781 gt_ggc_mx_symtab_node(void*)
> 	/export/gnu/import/git/gcc-test-spec-lto/bld/gcc/gtype-desc.c:1302
> 0xee51fd gt_ggc_ma_order
> 	./gt-passes.h:31
> 0xee51fd gt_ggc_ma_order
> 	./gt-passes.h:26
> 0xcf6995 ggc_mark_root_tab
> 	../../src-trunk/gcc/ggc-common.c:77
> 0xcf6b9c ggc_mark_roots()
> 	../../src-trunk/gcc/ggc-common.c:94
> 0xb274f5 ggc_collect()
> 	../../src-trunk/gcc/ggc-page.c:2201
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <https://gcc.gnu.org/bugs/> for instructions.
> [hjl@gnu-mic-1 build_base_lto.0000]$ 
> 
> -O2 -ffast-math is needed to trigger ICE.

Hm, I can't reproduce that. How have you configured the compiler?
Comment 11 H.J. Lu 2019-08-08 16:09:26 UTC
(In reply to Martin Liška from comment #10)
> (In reply to H.J. Lu from comment #9)
> > [hjl@gnu-mic-1 build_base_lto.0000]$
> > /export/gnu/import/git/gcc-test-spec-lto/usr/bin/g++ -S -DSPEC_CPU -DNDEBUG 
> > -DAPP_NO_THREADS -DXALAN_INMEM_MSG_LOADER -I. -Ixercesc -Ixercesc/dom
> > -Ixercesc/dom/impl -Ixercesc/sax -Ixercesc/util/MsgLoaders/InMemory
> > -Ixercesc/util/Transcoders/Iconv -Ixalanc/include -DPROJ_XMLPARSER
> > -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM
> > -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER
> > -O2    -DSPEC_CPU_LP64  -DSPEC_CPU_LINUX     XPath.cpp  -ffast-math
> > In file included from ./XPathDefinitions.hpp:21,
> >                  from XPath.hpp:22,
> >                  from XPath.cpp:18:
> > XPath.cpp: In member function ‘void
> > xalanc_1_8::XPath::executeMore(xalanc_1_8::XalanNode*,
> > xalanc_1_8::XPath::OpCodeMapPositionType,
> > xalanc_1_8::XPathExecutionContext&, xalanc_1_8::FormatterListener&,
> > xalanc_1_8::XPath::MemberFunctionPtr) const’:
> > ./PlatformDefinitions.hpp:66:35: internal compiler error: Segmentation fault
> >    66 |  #define XALAN_CPP_NAMESPACE_END  }
> >       |                                   ^
> > XPath.cpp:5696:1: note: in expansion of macro ‘XALAN_CPP_NAMESPACE_END’
> >  5696 | XALAN_CPP_NAMESPACE_END
> >       | ^~~~~~~~~~~~~~~~~~~~~~~
> > 0xfbcc0f crash_signal
> > 	../../src-trunk/gcc/toplev.c:326
> > 0xb26b73 lookup_page_table_entry
> > 	../../src-trunk/gcc/ggc-page.c:632
> > 0xb26b73 ggc_set_mark(void const*)
> > 	../../src-trunk/gcc/ggc-page.c:1531
> > 0xd6a781 gt_ggc_mx_symtab_node(void*)
> > 	/export/gnu/import/git/gcc-test-spec-lto/bld/gcc/gtype-desc.c:1302
> > 0xee51fd gt_ggc_ma_order
> > 	./gt-passes.h:31
> > 0xee51fd gt_ggc_ma_order
> > 	./gt-passes.h:26
> > 0xcf6995 ggc_mark_root_tab
> > 	../../src-trunk/gcc/ggc-common.c:77
> > 0xcf6b9c ggc_mark_roots()
> > 	../../src-trunk/gcc/ggc-common.c:94
> > 0xb274f5 ggc_collect()
> > 	../../src-trunk/gcc/ggc-page.c:2201
> > Please submit a full bug report,
> > with preprocessed source if appropriate.
> > Please include the complete backtrace with any bug report.
> > See <https://gcc.gnu.org/bugs/> for instructions.
> > [hjl@gnu-mic-1 build_base_lto.0000]$ 
> > 
> > -O2 -ffast-math is needed to trigger ICE.
> 
> Hm, I can't reproduce that. How have you configured the compiler?

I used:

 --enable-clocale=gnu --with-system-zlib --enable-shared --enable-cet --with-demangler-in-ld --with-fpmath=sse --enable-languages=c,c++,fortran,lto
Comment 12 H.J. Lu 2019-08-08 18:31:45 UTC
I opened PR 91404.