https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115598
Bug ID: 115598 Summary: ICE: in build_call_a, at cp/call.cc:370 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: --- Target: x86_64 ******************************************************************************* The compiler produces an internal error during build_call_a 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-15/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /root/gdbtest/gcc/obj/../gcc/configure --prefix=/root/gdbtest/gcc/gcc-15 --enable-languages=c,c++,fortran,go --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240509 (experimental) (GCC) ******************************************************************************* Program: # cat 2.ii namespace std { class exception { virtual ~exception() throw(); }; } namespace std __attribute__((__visibility__("default"))) { template <typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT>> class basic_string; typedef basic_string<char> string; } namespace boost { class exception { }; } namespace __cxxabiv1 { extern "C" void *__dynamic_cast(const void *__src_ptr, const __class_type_info *__src_type, const __class_type_info *__dst_type, ptrdiff_t __src2dst); inline std::string diagnostic_information_impl(boost::exception const *be, std::exception const *se, bool with_what) { if (!be) be = dynamic_cast<boost::exception const *>(se); } } ******************************************************************************* Command Lines: # g++ 2.ii -Werror -O2 -ftrapv -fstack-protector-strong -o -c 2.o \2.ii:10:49: error: ‘char_traits’ does not name a type 10 | template <typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT>> | ^~~~~~~~~~~ 2.ii:10:60: error: expected ‘>’ before ‘<’ token 10 | template <typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT>> | ^ 2.ii:12:28: error: template argument 2 is invalid 12 | typedef basic_string<char> string; | ^ 2.ii:22:64: error: ‘__class_type_info’ does not name a type 22 | extern "C" void *__dynamic_cast(const void *__src_ptr, const __class_type_info *__src_type, const __class_type_info *__dst_type, ptrdiff_t __src2dst); | ^~~~~~~~~~~~~~~~~ 2.ii:22:101: error: ‘__class_type_info’ does not name a type 22 | extern "C" void *__dynamic_cast(const void *__src_ptr, const __class_type_info *__src_type, const __class_type_info *__dst_type, ptrdiff_t __src2dst); | ^~~~~~~~~~~~~~~~~ 2.ii:22:132: error: ‘ptrdiff_t’ has not been declared 22 | extern "C" void *__dynamic_cast(const void *__src_ptr, const __class_type_info *__src_type, const __class_type_info *__dst_type, ptrdiff_t __src2dst); | ^~~~~~~~~ <built-in>: error: conflicting declaration of C function ‘void* __cxxabiv1::__dynamic_cast(const void*, const __class_type_info*, const __class_type_info*, long int)’ 2.ii:22:20: note: previous declaration ‘void* __cxxabiv1::__dynamic_cast(const void*, const int*, const int*, int)’ 22 | extern "C" void *__dynamic_cast(const void *__src_ptr, const __class_type_info *__src_type, const __class_type_info *__dst_type, ptrdiff_t __src2dst); | ^~~~~~~~~~~~~~ 2.ii: In function ‘std::string __cxxabiv1::diagnostic_information_impl(const boost::exception*, const std::exception*, bool)’: 2.ii:26:53: internal compiler error: in build_call_a, at cp/call.cc:370 26 | be = dynamic_cast<boost::exception const *>(se); | ^ 0x7958c9 build_call_a(tree_node*, int, tree_node**) /root/gdbtest/gcc/obj/../gcc/gcc/cp/call.cc:370 0xaa4a20 build_cxx_call(tree_node*, int, tree_node**, int, tree_node*) /root/gdbtest/gcc/obj/../gcc/gcc/cp/call.cc:11083 0xcf87e6 build_dynamic_cast_1 /root/gdbtest/gcc/obj/../gcc/gcc/cp/rtti.cc:797 0xcf87e6 build_dynamic_cast(unsigned int, tree_node*, tree_node*, int) /root/gdbtest/gcc/obj/../gcc/gcc/cp/rtti.cc:846 0xc6a538 cp_parser_postfix_expression /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:7598 0xc44eeb cp_parser_binary_expression /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:10398 0xc45c54 cp_parser_assignment_expression /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:10742 0xc46d9d cp_parser_constant_expression /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:11032 0xc47e66 cp_parser_initializer_clause /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26229 0xc45f1a cp_parser_assignment_expression /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:10760 0xc461f4 cp_parser_expression /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:10909 0xc4c927 cp_parser_expression_statement /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:13175 0xc8515b cp_parser_statement /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:12952 0xc86291 cp_parser_implicitly_scoped_statement /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15006 0xc86901 cp_parser_selection_statement /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:13703 0xc85105 cp_parser_statement /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:12726 0xc59807 cp_parser_statement_seq_opt /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:13427 0xc59a2f cp_parser_compound_statement /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:13281 0xc7ccd5 cp_parser_function_body /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26072 0xc7ccd5 cp_parser_ctor_initializer_opt_and_function_body /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26123 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. ******************************************************************************* Also ICE on trunk, compiler explorer:https://godbolt.org/z/qxa6rbobG *******************************************************************************