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

            Bug ID: 113088
           Summary: Segmentation fault with empty try/catch following
                    try/catch with returns + noexcept destructor
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: beardsley.matt.j at gmail dot com
  Target Milestone: ---

Compiling this works with gcc 11.4, but produces ICE (segv) with 12.1 (and
onwards, including trunk according to compiler explorer)


g++ x.cpp

x.cpp contains the following:


struct X {
    ~X() {}
};

struct Y {
    ~Y() noexcept(false) {}
};

X foo() {
    try {
        return {};
    } catch (...) {
        Y{};
        return {};
    }

    try {
    } catch (...) {
    }
}


<source>: In function 'X foo()':
<source>:18:5: internal compiler error: Segmentation fault
   18 |     } catch (...) {
      |     ^
0x262852c internal_error(char const*, ...)
        ???:0
0xb6109c maybe_splice_retval_cleanup(tree_node*, bool)
        ???:0
0xcbd15f do_poplevel(tree_node*)
        ???:0
0xcc068d finish_compound_stmt(tree_node*)
        ???:0
0xc4a0ca c_parse_file()
        ???:0
0xd9a469 c_common_parse_file()
        ???:0
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.
Compiler returned: 1


https://godbolt.org/z/b853srj6d

Reply via email to