https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98150

            Bug ID: 98150
           Summary: Segfault from statement expression in lambda noexcept
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ndkrempel at gmail dot com
  Target Milestone: ---

The following code produces a segfault in gcc versions 8.1 up to 10.2 and trunk
(using -std=c++2a or -std=c++20):

  int main() {
    []()noexcept(noexcept(({constexpr int&&x=1;})));
  }

Here's the stack trace from trunk (https://gcc.godbolt.org/z/nqoojv):

<source>: In function 'int main()':
<source>:2:44: internal compiler error: Segmentation fault
    2 |   []()noexcept(noexcept(({constexpr int&&x=1;})));
      |                                            ^
0x1c354c9 internal_error(char const*, ...)
        ???:0
0x80119c mangle_ref_init_variable(tree_node*)
        ???:0
0x6b4419 make_temporary_var_for_ref_to_temp(tree_node*, tree_node*)
        ???:0
0x9892ae store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0x7974d0 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ???:0
0x87f79c c_parse_file()
        ???:0
0x9f9512 c_common_parse_file()
        ???: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
<source>: In function 'int main()':
<source>:2:44: internal compiler error: Segmentation fault
    2 |   []()noexcept(noexcept(({constexpr int&&x=1;})));
      |                                            ^
0x1c354c9 internal_error(char const*, ...)
        ???:0
0x80119c mangle_ref_init_variable(tree_node*)
        ???:0
0x6b4419 make_temporary_var_for_ref_to_temp(tree_node*, tree_node*)
        ???:0
0x9892ae store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0x7974d0 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ???:0
0x87f79c c_parse_file()
        ???:0
0x9f9512 c_common_parse_file()
        ???: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

Reply via email to