public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113088] New: Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor
@ 2023-12-19 23:40 beardsley.matt.j at gmail dot com
  2023-12-20  0:29 ` [Bug c++/113088] [12/13/14 Regression] " ppalka at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: beardsley.matt.j at gmail dot com @ 2023-12-19 23:40 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/113088] [12/13/14 Regression] Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor
  2023-12-19 23:40 [Bug c++/113088] New: Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor beardsley.matt.j at gmail dot com
@ 2023-12-20  0:29 ` ppalka at gcc dot gnu.org
  2023-12-20  8:01 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-12-20  0:29 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
   Target Milestone|---                         |12.4
             Status|UNCONFIRMED                 |NEW
            Summary|Segmentation fault with     |[12/13/14 Regression]
                   |empty try/catch following   |Segmentation fault with
                   |try/catch with returns +    |empty try/catch following
                   |noexcept destructor         |try/catch with returns +
                   |                            |noexcept destructor
      Known to fail|                            |12.3.0, 13.2.0, 14.0
     Ever confirmed|0                           |1
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=33799
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2023-12-20
      Known to work|                            |11.4.0

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, started with r12-6333-gb10e031458d541.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/113088] [12/13/14 Regression] Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor
  2023-12-19 23:40 [Bug c++/113088] New: Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor beardsley.matt.j at gmail dot com
  2023-12-20  0:29 ` [Bug c++/113088] [12/13/14 Regression] " ppalka at gcc dot gnu.org
@ 2023-12-20  8:01 ` rguenth at gcc dot gnu.org
  2023-12-20 15:53 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-12-20  8:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/113088] [12/13/14 Regression] Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor
  2023-12-19 23:40 [Bug c++/113088] New: Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor beardsley.matt.j at gmail dot com
  2023-12-20  0:29 ` [Bug c++/113088] [12/13/14 Regression] " ppalka at gcc dot gnu.org
  2023-12-20  8:01 ` rguenth at gcc dot gnu.org
@ 2023-12-20 15:53 ` jason at gcc dot gnu.org
  2023-12-20 17:31 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2023-12-20 15:53 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/113088] [12/13/14 Regression] Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor
  2023-12-19 23:40 [Bug c++/113088] New: Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor beardsley.matt.j at gmail dot com
                   ` (2 preceding siblings ...)
  2023-12-20 15:53 ` jason at gcc dot gnu.org
@ 2023-12-20 17:31 ` cvs-commit at gcc dot gnu.org
  2024-01-24 19:39 ` [Bug c++/113088] [12/13 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-20 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:02c0b49798228d777610f898cd9d63ebec43656d

commit r14-6754-g02c0b49798228d777610f898cd9d63ebec43656d
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Dec 20 11:06:27 2023 -0500

    c++: throwing dtor and empty try [PR113088]

    maybe_splice_retval_cleanup assumed that the function body can't be empty
if
    there's a throwing cleanup, but when I added cleanups to try blocks in
    r12-6333-gb10e031458d541 I didn't adjust that assumption.

            PR c++/113088
            PR c++/33799

    gcc/cp/ChangeLog:

            * except.cc (maybe_splice_retval_cleanup): Handle an empty block.

    gcc/testsuite/ChangeLog:

            * g++.dg/eh/return2.C: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/113088] [12/13 Regression] Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor
  2023-12-19 23:40 [Bug c++/113088] New: Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor beardsley.matt.j at gmail dot com
                   ` (3 preceding siblings ...)
  2023-12-20 17:31 ` cvs-commit at gcc dot gnu.org
@ 2024-01-24 19:39 ` cvs-commit at gcc dot gnu.org
  2024-01-24 19:40 ` cvs-commit at gcc dot gnu.org
  2024-01-24 19:47 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-24 19:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:60bfd373a1891ae2349dc67313d104079ce8c706

commit r13-8247-g60bfd373a1891ae2349dc67313d104079ce8c706
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Dec 20 11:06:27 2023 -0500

    c++: throwing dtor and empty try [PR113088]

    maybe_splice_retval_cleanup assumed that the function body can't be empty
if
    there's a throwing cleanup, but when I added cleanups to try blocks in
    r12-6333-gb10e031458d541 I didn't adjust that assumption.

            PR c++/113088
            PR c++/33799

    gcc/cp/ChangeLog:

            * except.cc (maybe_splice_retval_cleanup): Handle an empty block.

    gcc/testsuite/ChangeLog:

            * g++.dg/eh/return2.C: New test.

    (cherry picked from commit 02c0b49798228d777610f898cd9d63ebec43656d)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/113088] [12/13 Regression] Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor
  2023-12-19 23:40 [Bug c++/113088] New: Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor beardsley.matt.j at gmail dot com
                   ` (4 preceding siblings ...)
  2024-01-24 19:39 ` [Bug c++/113088] [12/13 " cvs-commit at gcc dot gnu.org
@ 2024-01-24 19:40 ` cvs-commit at gcc dot gnu.org
  2024-01-24 19:47 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-24 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:b0605cd4a12e9162cc56abc69ca1048947c72689

commit r12-10110-gb0605cd4a12e9162cc56abc69ca1048947c72689
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Dec 20 11:06:27 2023 -0500

    c++: throwing dtor and empty try [PR113088]

    maybe_splice_retval_cleanup assumed that the function body can't be empty
if
    there's a throwing cleanup, but when I added cleanups to try blocks in
    r12-6333-gb10e031458d541 I didn't adjust that assumption.

            PR c++/113088
            PR c++/33799

    gcc/cp/ChangeLog:

            * except.cc (maybe_splice_retval_cleanup): Handle an empty block.

    gcc/testsuite/ChangeLog:

            * g++.dg/eh/return2.C: New test.

    (cherry picked from commit 02c0b49798228d777610f898cd9d63ebec43656d)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/113088] [12/13 Regression] Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor
  2023-12-19 23:40 [Bug c++/113088] New: Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor beardsley.matt.j at gmail dot com
                   ` (5 preceding siblings ...)
  2024-01-24 19:40 ` cvs-commit at gcc dot gnu.org
@ 2024-01-24 19:47 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2024-01-24 19:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 12.4/13.3.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-01-24 19:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-19 23:40 [Bug c++/113088] New: Segmentation fault with empty try/catch following try/catch with returns + noexcept destructor beardsley.matt.j at gmail dot com
2023-12-20  0:29 ` [Bug c++/113088] [12/13/14 Regression] " ppalka at gcc dot gnu.org
2023-12-20  8:01 ` rguenth at gcc dot gnu.org
2023-12-20 15:53 ` jason at gcc dot gnu.org
2023-12-20 17:31 ` cvs-commit at gcc dot gnu.org
2024-01-24 19:39 ` [Bug c++/113088] [12/13 " cvs-commit at gcc dot gnu.org
2024-01-24 19:40 ` cvs-commit at gcc dot gnu.org
2024-01-24 19:47 ` jason at gcc dot gnu.org

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).