public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hp at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113545] New: ICE in label_matches with constexpr function with switch-statement and converted (nonconstant, cast address) input Date: Mon, 22 Jan 2024 16:53:56 +0000 [thread overview] Message-ID: <bug-113545-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113545 Bug ID: 113545 Summary: ICE in label_matches with constexpr function with switch-statement and converted (nonconstant, cast address) input Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hp at gcc dot gnu.org Target Milestone: --- For the following test-case, g++ ICEs from at least gcc-10 and forward (i.e. apparently not a regression): ``` char foo; constexpr unsigned char bar(__UINTPTR_TYPE__ baz) { switch (baz) { case 13: return 11; case 14: return 78; case 2048: return 13; default: return 42; } } __attribute__ ((__noipa__)) void xyzzy(int x) { if (x != 42) __builtin_abort (); } int main() { unsigned const char c = bar(reinterpret_cast<__UINTPTR_TYPE__>(&foo)); xyzzy(c); } ''' Example backtrace with -std=c++20 -O3: ../n.cc: In function 'int main()': ../n.cc:27:30: in 'constexpr' expansion of 'bar(((long unsigned int)(& foo)))' ../n.cc:5:3: internal compiler error: in label_matches, at cp/constexpr.cc:6925 5 | switch (baz) | ^~~~~~ 0x63894c label_matches /gcctop/gcc/cp/constexpr.cc:6925 0xa0bb3d cxx_eval_constant_expression /gcctop/gcc/cp/constexpr.cc:7319 0xa0d2b2 cxx_eval_statement_list /gcctop/gcc/cp/constexpr.cc:6969 0xa0d2b2 cxx_eval_constant_expression /gcctop/gcc/cp/constexpr.cc:8316 0xa1e782 cxx_eval_switch_expr /gcctop/gcc/cp/constexpr.cc:7115 0xa0cb6b cxx_eval_constant_expression /gcctop/gcc/cp/constexpr.cc:8412 0xa0aae6 cxx_eval_call_expression /gcctop/gcc/cp/constexpr.cc:3288 0xa0c2ef cxx_eval_constant_expression /gcctop/gcc/cp/constexpr.cc:7524 0xa17d9a cxx_eval_outermost_constant_expr /gcctop/gcc/cp/constexpr.cc:8822 0xa1d28f maybe_constant_value(tree_node*, tree_node*, mce_value) /gcctop/gcc/cp/constexpr.cc:9110 0xa49e40 cp_fully_fold /gcctop/gcc/cp/cp-gimplify.cc:2831 0xa49ed9 cp_fully_fold /gcctop/gcc/cp/cp-gimplify.cc:2825 0xa49ed9 cp_fully_fold_init(tree_node*) /gcctop/gcc/cp/cp-gimplify.cc:2861 0xc7a204 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) /gcctop/gcc/cp/typeck2.cc:926 0xa6ca32 check_initializer /gcctop/gcc/cp/decl.cc:7810 0xa941be cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int, cp_decomp*) /gcctop/gcc/cp/decl.cc:8842 0xb95477 cp_parser_init_declarator /gcctop/gcc/cp/parser.cc:23618 0xb6ac98 cp_parser_simple_declaration /gcctop/gcc/cp/parser.cc:15890 0xb8f830 cp_parser_declaration_statement /gcctop/gcc/cp/parser.cc:14926 0xb97215 cp_parser_statement /gcctop/gcc/cp/parser.cc:12882 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.
next reply other threads:[~2024-01-22 16:53 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-22 16:53 hp at gcc dot gnu.org [this message] 2024-01-22 17:21 ` [Bug c++/113545] " hp at gcc dot gnu.org 2024-02-07 0:31 ` hp at gcc dot gnu.org 2024-02-07 0:32 ` hp at gcc dot gnu.org 2024-02-10 3:41 ` cvs-commit at gcc dot gnu.org 2024-02-12 19:56 ` cvs-commit at gcc dot gnu.org 2024-02-12 20:02 ` mpolacek at gcc dot gnu.org 2024-02-14 1:17 ` hp at gcc dot gnu.org 2024-02-16 17:30 ` cvs-commit at gcc dot gnu.org 2024-02-16 17:30 ` mpolacek at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-113545-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).