https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71353
Bug ID: 71353 Summary: ICE on valid code at -O1 and above on x86_64-linux-gnu: in binds_to_current_def_p, at symtab.c:2232 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following code causes an ICE when compiled with the current GCC trunk at -O1 and above on x86_64-linux-gnu in both 32-bit and 64-bit modes. This is a regression from 6.1.x. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.0 20160530 (experimental) [trunk revision 236873] (GCC) $ $ g++-trunk -O0 -c small.cpp $ g++-6.1 -O1 -c small.cpp $ $ g++-trunk -O1 -c small.cpp _ZL3barv/1 (int bar()) @0x7f77e841e170 Type: function definition analyzed alias transparent_alias weakref Visibility: weak References: foo/0 (alias) Referring: Availability: available First run: 0 Function flags: process Called by: _Z3bazv/2 (1.00 per call) (can throw external) Calls: small.cpp: In function ‘int foo()’: small.cpp:12:1: internal compiler error: in binds_to_current_def_p, at symtab.c:2232 } ^ 0x9a72a8 symtab_node::binds_to_current_def_p(symtab_node*) ../../gcc-source-trunk/gcc/symtab.c:2232 0x9b0689 set_const_flag_1 ../../gcc-source-trunk/gcc/cgraph.c:2488 0x9b059c set_const_flag_1 ../../gcc-source-trunk/gcc/cgraph.c:2519 0x9b08ff cgraph_node::set_const_flag(bool, bool) ../../gcc-source-trunk/gcc/cgraph.c:2550 0x14c5791 execute ../../gcc-source-trunk/gcc/ipa-pure-const.c:1829 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ ---------------------------------------------------------------- extern "C" __inline __attribute__ ((__gnu_inline__)) int foo () { return 0; } static __typeof foo bar __attribute__ ((__weakref__ ("foo"))); void baz () { bar (); }