public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "royalbee at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102626] New: [c++20] compiler crash when invoking constexpr function in the constructor of template class Date: Wed, 06 Oct 2021 06:41:32 +0000 [thread overview] Message-ID: <bug-102626-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102626 Bug ID: 102626 Summary: [c++20] compiler crash when invoking constexpr function in the constructor of template class Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: royalbee at gmail dot com Target Milestone: --- * version: g++ (Compiler-Explorer-Build-gcc--binutils-2.36.1) 11.2.0 * compile options: -std=c++20 -O3 * online example: https://godbolt.org/z/hz61so9vc * compiling produces error: during RTL pass: expand <source>: In function 'int main()': <source>:15:50: internal compiler error: Segmentation fault 15 | auto p = packed<A, &A::x, &A::y>{std::span(buf)}; | ^ 0x1786229 internal_error(char const*, ...) ???:0 0xff757b make_decl_rtl(tree_node*) ???:0 0x8f9536 expand_call(tree_node*, rtx_def*, int) ???:0 0xa0ff2e expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ???:0 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. ASM generation compiler returned: 1 during RTL pass: expand <source>: In function 'int main()': <source>:15:50: internal compiler error: Segmentation fault 15 | auto p = packed<A, &A::x, &A::y>{std::span(buf)}; | ^ 0x1786229 internal_error(char const*, ...) ???:0 0xff757b make_decl_rtl(tree_node*) ???:0 0x8f9536 expand_call(tree_node*, rtx_def*, int) ???:0 0xa0ff2e expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ???:0 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Execution build compiler returned: 1 * code: #include <span> template <typename T, auto ...ms> struct packed; template <typename S, typename ...Ts, Ts S::* ...ms> struct packed<S, ms...> { static constexpr size_t size() { return (sizeof(S{}.*ms) + ...); } std::span<std::byte> buf; packed(auto b) : buf(b.first(size())) {} //<<< removing call to size() fixes the issue }; int main() { struct A {int x, y;}; std::byte buf[100]; auto p = packed<A, &A::x, &A::y>{std::span(buf)}; static_assert(p.size() == 8); return 0; }
next reply other threads:[~2021-10-06 6:41 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-06 6:41 royalbee at gmail dot com [this message] 2021-10-11 8:31 ` [Bug c++/102626] " marxin at gcc dot gnu.org 2021-10-11 8:40 ` jakub at gcc dot gnu.org 2021-10-11 9:50 ` marxin at gcc dot gnu.org 2024-01-22 16:09 ` hp at gcc dot gnu.org 2024-01-22 17:10 ` ppalka 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-102626-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).