https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117837
Bug ID: 117837
Summary: ICE: verify_cgraph_node failed
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: iamanonymous.cs at gmail dot com
Target Milestone: ---
*******************************************************************************
The compiler produces an internal error during cgraph_node::verify_node() when
compiling the provided code with the specified options.
The issue can also be reproduced on Compiler Explorer.
*******************************************************************************
OS and Platform:
# uname -a
Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
*******************************************************************************
# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-241127/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gdbtest/gcc/gcc-241127
--enable-languages=c,c++ --disable-multilib --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20241127 (experimental) (GCC)
*******************************************************************************
Program:
#cat bug.cpp
struct A {
__attribute__ ((exclude_from_explicit_instantiation))
A(int, float) {}
};
static void ref_to_A(void) __attribute__((weakref("_ZN1AC2Eif")));
struct B {
A a;
B() : a(1,2.f) {}
} B;
int main() {
return ref_to_A ? 1 : 0;
}
*******************************************************************************
Command Lines:
# g++ -funroll-loops -fforward-propagate -ffunction-sections -flto -O2 -Wall
-Wextra -fno-strict-aliasing -fwrapv -g -fsanitize=address -c bug.cpp
<source>:3:17: warning: 'exclude_from_explicit_instantiation' attribute
directive ignored [-Wattributes]
3 | A(int, float) {}
| ^
<source>:6:13: warning: 'void ref_to_A()' alias between functions of
incompatible types 'void()' and 'void (A::)(int, float)' [-Wattribute-alias=]
6 | static void ref_to_A(void) __attribute__((weakref("_ZN1AC2Eif")));
| ^~~~~~~~
<source>:3:5: note: aliased declaration here
3 | A(int, float) {}
| ^
<source>:15:1: error: comdat-local symbol referred to by int main() outside its
comdat
15 | }
| ^
_ZL8ref_to_Av/3 (void ref_to_A())
Type: function definition analyzed alias transparent_alias weakref
Visibility: semantic_interposition weak comdat_group:_ZN1AC5Eif
Same comdat group as: _ZN1AC2Eif/1
Address is taken.
References: _ZN1AC2Eif/1 (alias)
Referring: main/8 (addr)
Function flags:
Called by:
Calls:
<source>:15:1: internal compiler error: verify_cgraph_node failed
0x28d1025 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x28e7d15 internal_error(char const*, ...)
???:0
0xecf3e8 cgraph_node::verify_node()
???:0
0xebdcf4 symtab_node::verify()
???:0
0xebeed7 symtab_node::verify_symtab_nodes()
???:0
0xed7c5b symbol_table::finalize_compilation_unit()
???:0
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.
Compiler returned: 1
*******************************************************************************
Also ICE on trunk, compiler explorer:https://godbolt.org/z/WEzo8qcrr
*******************************************************************************