From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 352533858CD9; Fri, 24 May 2024 22:51:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 352533858CD9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716591080; bh=kOlP/VsOZfmE9Qg1AJ/pTyukYRTf2X98zIn3yzfPsKQ=; h=From:To:Subject:Date:From; b=lI0NssNBopWdNALttOhad0L2fVwiYRKZ9FZuJjp38o1jjiSXK+IkTshLePomrPm/W 9TiaUqXpsXdL0L+nM6SH5K5C+Gh0OjlcltaiICBh+fkYbtcur7cE9D9fLoNqTbSvt6 A6iO3SwDLTDT4FglSQXj0LVoz9s75XmCbEEgBDiU= From: "pobrn at protonmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115219] New: ICE on conditionally noexcept class operator delete Date: Fri, 24 May 2024 22:51:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pobrn at protonmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115219 Bug ID: 115219 Summary: ICE on conditionally noexcept class operator delete Product: gcc Version: 14.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pobrn at protonmail dot com Target Milestone: --- Consider the following piece of C++ code: ``` #include #include template struct B { static void * operator new(std::size_t s, std::size_t) { return ::operator new(s); } static void operator delete(void *) noexcept(std::is_nothrow_destructible_v) { } }; struct A : B { }; void test() { new (42) A(); } ``` gcc 14.1.1 and trunk (on CE) trigger the following ICE ( https://gcc.godbolt.org/z/z7av1Mf3Y ): ``` : In function 'void test()': :19:16: internal compiler error: in type_throw_all_p, at cp/except.cc:1234 19 | new (42) A(); | ^ 0x268e9ac internal_error(char const*, ...) ???:0 0xa5b247 fancy_abort(char const*, int, char const*) ???:0 0xb08bb3 fnptr_conv_p(tree_node*, tree_node*) ???:0 0xaa0ae6 instantiate_type(tree_node*, tree_node*, int) ???:0 0xa75b7e build_op_delete_call(tree_code, tree_node*, tree_node*, bool, tree_node*, tree_node*, int) ???:0 0xb82ab0 build_new(unsigned int, vec**, tree_node*, tree_node*, vec**, int, int) ???:0 0xc63d8a c_parse_file() ???:0 0xdb95b9 c_common_parse_file() ???:0 ``` Removing the conditional noexcept specification makes the ICE go away. Here is a more detailed stack trace from the arch linux build of gcc (about 14.1.1): ``` Breakpoint 1, internal_error (gmsgid=3Dgmsgid@entry=3D0x2b4b860 "in %s, at = %s:%d") at /usr/src/debug/gcc/gcc/gcc/diagnostic.cc:2227 2227 { (gdb) bt #0 internal_error (gmsgid=3Dgmsgid@entry=3D0x2b4b860 "in %s, at %s:%d") at /usr/src/debug/gcc/gcc/gcc/diagnostic.cc:2227 #1 0x0000000000703e88 in fancy_abort (file=3D0x2b5c798 "/usr/src/debug/gcc/gcc/gcc/cp/except.cc", line=3D1234, function=3D0x2aa87dc "type_throw_all_p") at /usr/src/debug/gcc/gcc/gcc/diagnostic.cc:2353 #2 0x00000000006b97f2 in type_throw_all_p (type=3D) at /usr/src/debug/gcc/gcc/gcc/cp/except.cc:1231 #3 type_throw_all_p (type=3D) at /usr/src/debug/gcc/gcc/gcc/cp/except.cc:1231 #4 noexcept_conv_p (to=3D0x7ffff6c24498, from=3D0x7ffff6a15930) at /usr/src/debug/gcc/gcc/gcc/cp/cvt.cc:2130 #5 fnptr_conv_p (to=3D, from=3D) at /usr/src/debug/gcc/gcc/gcc/cp/cvt.cc:2157 #6 0x000000000072a772 in instantiate_type (lhstype=3D0x7ffff6c24498, rhs=3D0x7ffff6a10690, complain=3D0) at /usr/src/debug/gcc/gcc/gcc/cp/class.= cc:9085 #7 0x000000000072cede in build_op_delete_call (code=3DDELETE_EXPR, addr=3D0x7ffff6a1e1e0, size=3D0x7ffff6e212d0, global_p=3D, placement=3D0x7ffff6a1b340, alloc_fn=3D0x7ffff6de9700, complain=3D3) at /usr/src/debug/gcc/gcc/gcc/cp/call.cc:7893 #8 0x0000000000804299 in build_new_1 (placement=3Dplacement@entry=3D0x7fffffffcd78, type=3D, nelts=3D, nelts@entry=3D0x0, init=3Dinit@entry=3D0x7fffffffc= d70,=20 globally_qualified_p=3Dglobally_qualified_p@entry=3Dfalse, complain=3Dcomplain@entry=3D3) at /usr/src/debug/gcc/gcc/gcc/cp/init.cc:3784 #9 0x00000000008055ca in build_new (loc=3D64384747, placement=3D0x7fffffff= cd78, type=3D, nelts=3D0x0, init=3D0x7fffffffcd70, use_global_new= =3D0, complain=3D3) at /usr/src/debug/gcc/gcc/gcc/cp/init.cc:4054 #10 0x0000000000867ab7 in cp_parser_new_expression (parser=3Dparser@entry=3D0x7ffff6fb4dc8) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:9659 #11 0x000000000086258b in cp_parser_unary_expression (parser=3D0x7ffff6fb4d= c8, pidk=3D, address_p=3D, cast_p=3D, decltype_p=3D) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:9245 #12 0x0000000000864664 in cp_parser_binary_expression (parser=3Dparser@entry=3D0x7ffff6fb4dc8, cast_p=3Dcast_p@entry=3Dfalse, no_toplevel_fold_p=3Dno_toplevel_fold_p@entry=3Dfalse, decltype_p=3Ddecltype_p@entry=3Dfalse,=20 prec=3Dprec@entry=3DPREC_NOT_OPERATOR, pidk=3Dpidk@entry=3D0x0) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:10393 #13 0x00000000008653bd in cp_parser_assignment_expression (parser=3Dparser@entry=3D0x7ffff6fb4dc8, pidk=3Dpidk@entry=3D0x0, cast_p=3Dcast_p@entry=3Dfalse, decltype_p=3Ddecltype_p@entry=3Dfalse) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:10737 #14 0x0000000000865994 in cp_parser_expression (parser=3Dparser@entry=3D0x7ffff6fb4dc8, pidk=3Dpidk@entry=3D0x0, cast_p=3Dcast_p@entry=3Dfalse, decltype_p=3Ddecltype_p@entry=3Dfalse, warn_comma_p=3Dwarn_comma_p@entry=3Dfalse) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:10903 #15 0x000000000086622e in cp_parser_expression_statement (parser=3D0x7ffff6fb4dc8, in_statement_expr=3D0x0) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:13166 #16 0x0000000000876d31 in cp_parser_statement (parser=3Dparser@entry=3D0x7ffff6fb4dc8, in_statement_expr=3Din_statement_expr@entry=3D0x0, in_compound=3Din_compound@entry=3Dtrue, if_p=3Dif_p@entry=3D0x0, chain=3Dch= ain@entry=3D0x0,=20 loc_after_labels=3Dloc_after_labels@entry=3D0x0) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:12947 #17 0x0000000000877b0c in cp_parser_statement_seq_opt (parser=3Dparser@entry=3D0x7ffff6fb4dc8, in_statement_expr=3Din_statement_expr@entry=3D0x0) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:13418 #18 0x0000000000877d40 in cp_parser_compound_statement (parser=3D0x7ffff6fb= 4dc8, in_statement_expr=3D0x0, bcs_flags=3D, function_body=3Dtrue)= at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:13272 #19 0x0000000000883042 in cp_parser_function_body (parser=3D0x7ffff6fb4dc8, in_function_try_block=3Dfalse) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:2= 5987 #20 cp_parser_ctor_initializer_opt_and_function_body (parser=3D0x7ffff6fb4d= c8, in_function_try_block=3Dfalse) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:2= 6038 #21 0x00000000008a8d2b in cp_parser_function_definition_after_declarator (parser=3Dparser@entry=3D0x7ffff6fb4dc8, inline_p=3Dinline_p@entry=3Dfalse)= at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:32729 #22 0x00000000008a9e50 in cp_parser_function_definition_from_specifiers_and_declarator (parser=3D0x7ffff6fb4dc8, decl_specifiers=3D, attributes=3D0= x0, declarator=3D0x31fb9a0) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:32647 #23 cp_parser_init_declarator (parser=3D0x7ffff6fb4dc8, flags=3D, decl_specifiers=3D, checks=3D0x0, function_definition_allowed_p=3D, member_p=3Dfalse,=20 declares_class_or_enum=3D0, function_definition_p=3D0x7fffffffd6f8, maybe_range_for_decl=3D0x0, init_loc=3D0x7fffffffd6f0, auto_result=3D0x7fff= ffffd700) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:23366 #24 0x0000000000873c72 in cp_parser_simple_declaration (parser=3D0x7ffff6fb= 4dc8, function_definition_allowed_p=3D, maybe_range_for_decl=3D0x0= ) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:15900 #25 0x0000000000878ccd in cp_parser_declaration (parser=3D0x7ffff6fb4dc8, prefix_attrs=3D0x0) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:15573 #26 0x0000000000879734 in cp_parser_toplevel_declaration (parser=3D0x7ffff6fb4dc8) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:15594 #27 cp_parser_translation_unit (parser=3D0x7ffff6fb4dc8) at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:5279 #28 0x00000000009c4ed1 in c_parse_file () at /usr/src/debug/gcc/gcc/gcc/cp/parser.cc:51269 #29 c_common_parse_file () at /usr/src/debug/gcc/gcc/gcc/c-family/c-opts.cc:1311 #30 0x0000000000fa020f in compile_file () at /usr/src/debug/gcc/gcc/gcc/toplev.cc:449 #31 0x000000000070d122 in do_compile () at /usr/src/debug/gcc/gcc/gcc/toplev.cc:2154 #32 toplev::main (this=3D, argc=3D, argv=3D) at /usr/src/debug/gcc/gcc/gcc/toplev.cc:2310 #33 0x000000000070da36 in main (argc=3D, argv=3D) at /usr/src/debug/gcc/gcc/gcc/main.cc:39 ```=