https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71616
Bug ID: 71616
Summary: ICE on valid C++ 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 C++ 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 20160621 (experimental) [trunk revision 237650] (GCC)
$
$ g++-trunk -O0 -c small.cpp
$ g++-6.1 -O1 -c small.cpp
$
$ g++-trunk -O1 -c small.cpp
_ZL21__gthrw_pthread_equalv/1 (int __gthrw_pthread_equal()) @0x7f9c64d75170
Type: function definition analyzed alias transparent_alias weakref
Visibility: weak
References: pthread_equal/0 (alias)
Referring:
Availability: available
First run: 0
Function flags: process
Called by: _Z3foov/2 (1.00 per call) (can throw external)
Calls:
small.cpp: In function ‘int pthread_equal()’:
small.cpp:10:1: internal compiler error: in binds_to_current_def_p, at
symtab.c:2232
}
^
0x9ad798 symtab_node::binds_to_current_def_p(symtab_node*)
../../gcc-source-trunk/gcc/symtab.c:2232
0x9b6b29 set_const_flag_1
../../gcc-source-trunk/gcc/cgraph.c:2500
0x9b6a3c set_const_flag_1
../../gcc-source-trunk/gcc/cgraph.c:2531
0x9b6d9f cgraph_node::set_const_flag(bool, bool)
../../gcc-source-trunk/gcc/cgraph.c:2562
0x14e2a41 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 pthread_equal () {}
static __typeof pthread_equal __gthrw_pthread_equal
__attribute__ ((__weakref__ ("pthread_equal")));
void foo ()
{
__gthrw_pthread_equal ();
}