public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional
@ 2023-06-03 18:18 stevenxia990430 at gmail dot com
  2023-06-03 18:29 ` [Bug c++/110106] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: stevenxia990430 at gmail dot com @ 2023-06-03 18:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110106
           Summary: ICE on noexcept(noexcept(...)) with optional
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stevenxia990430 at gmail dot com
  Target Milestone: ---

The following program produces internal compiler error: Segmentation fault.
Tested on GCC-trunk. Note replacing the std::optional<int>{z} inside the
noexcept with just {z} compiles with failure. 

To quickly reproduce: https://gcc.godbolt.org/z/dhjETE7K3
```
#include <optional>

namespace x {
void y(std::optional<int> z) noexcept(noexcept(std::optional<int>{z})) {}
}

int main() {

}
```


tested this on clang-trunk and it successfully compiles.

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

* [Bug c++/110106] [11/12/13/14 Regression] ICE on noexcept(noexcept(...)) with optional
  2023-06-03 18:18 [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional stevenxia990430 at gmail dot com
@ 2023-06-03 18:29 ` pinskia at gcc dot gnu.org
  2023-06-03 19:31 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-03 18:29 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-06-03
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Slightly more reduced:
```
#include <optional>

struct g
{
  g(int);
};

void y(std::optional<int> z) noexcept(noexcept(g{z}));

```

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

* [Bug c++/110106] [11/12/13/14 Regression] ICE on noexcept(noexcept(...)) with optional
  2023-06-03 18:18 [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional stevenxia990430 at gmail dot com
  2023-06-03 18:29 ` [Bug c++/110106] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
@ 2023-06-03 19:31 ` pinskia at gcc dot gnu.org
  2023-06-03 19:34 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-03 19:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
template <int> struct j{ };
struct g {g(j<0>);};
void y(j<0> z) noexcept(noexcept(g{z}));
```

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

* [Bug c++/110106] [11/12/13/14 Regression] ICE on noexcept(noexcept(...)) with optional
  2023-06-03 18:18 [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional stevenxia990430 at gmail dot com
  2023-06-03 18:29 ` [Bug c++/110106] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
  2023-06-03 19:31 ` pinskia at gcc dot gnu.org
@ 2023-06-03 19:34 ` pinskia at gcc dot gnu.org
  2023-06-05  6:46 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-03 19:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The full backtrace of the seg fault:
t0.cc:3:36: internal compiler error: Segmentation fault
    3 | void y(j<0> z) noexcept(noexcept(g{z}));
      |                                    ^
0x128f4af crash_signal
        /home/apinski/src/upstream-gcc-git/gcc/gcc/toplev.cc:314
0x7f37b9c54def ???
       
/usr/src/debug/glibc-2.34-60.el9.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xa40753 tree_check(tree_node*, char const*, int, char const*, tree_code)
        /home/apinski/src/upstream-gcc-git/gcc/gcc/tree.h:3539
0xa40753 is_really_empty_class(tree_node*, bool)
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/class.cc:8960
0xa6aa99 potential_constant_expression_1
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/constexpr.cc:9095
0xa69714 potential_constant_expression_1
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/constexpr.cc:9309
0xa6be0c potential_constant_expression_1(tree_node*, bool, bool, bool, bool,
int)
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/constexpr.cc:10131
0xa6be0c is_rvalue_constant_expression(tree_node*)
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/constexpr.cc:10215
0xba4e75 cp_parser_constant_expression
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:10801
0xba6301 cp_parser_initializer_clause
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:25522
0xba58e1 cp_parser_initializer_list
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:25812
0xba58e1 cp_parser_braced_list
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:25563
0xba8b4c cp_parser_functional_cast
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:32647
0xbb8547 cp_parser_postfix_expression
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:7703
0xba0d6b cp_parser_binary_expression
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:10147
0xba1c72 cp_parser_assignment_expression
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:10491
0xba41c3 cp_parser_expression
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:10661
0xbd6aa8 cp_parser_unary_expression
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:8937
0xba0d6b cp_parser_binary_expression
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:10147
0xba1c72 cp_parser_assignment_expression
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:10491
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.

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

* [Bug c++/110106] [11/12/13/14 Regression] ICE on noexcept(noexcept(...)) with optional
  2023-06-03 18:18 [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional stevenxia990430 at gmail dot com
                   ` (2 preceding siblings ...)
  2023-06-03 19:34 ` pinskia at gcc dot gnu.org
@ 2023-06-05  6:46 ` rguenth at gcc dot gnu.org
  2023-06-05 15:28 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-05  6:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.5

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

* [Bug c++/110106] [11/12/13/14 Regression] ICE on noexcept(noexcept(...)) with optional
  2023-06-03 18:18 [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional stevenxia990430 at gmail dot com
                   ` (3 preceding siblings ...)
  2023-06-05  6:46 ` rguenth at gcc dot gnu.org
@ 2023-06-05 15:28 ` mpolacek at gcc dot gnu.org
  2023-07-18 20:01 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-06-05 15:28 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r11-557:

commit beb019d346b903c16b9fd349937de444b6a8b6c0
Author: Jason Merrill <jason@redhat.com>
Date:   Thu May 21 10:27:11 2020 -0400

    c++: Constant expression parsing and parameters.

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

* [Bug c++/110106] [11/12/13/14 Regression] ICE on noexcept(noexcept(...)) with optional
  2023-06-03 18:18 [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional stevenxia990430 at gmail dot com
                   ` (4 preceding siblings ...)
  2023-06-05 15:28 ` mpolacek at gcc dot gnu.org
@ 2023-07-18 20:01 ` mpolacek at gcc dot gnu.org
  2023-07-21 17:52 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-07-18 20:01 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

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

* [Bug c++/110106] [11/12/13/14 Regression] ICE on noexcept(noexcept(...)) with optional
  2023-06-03 18:18 [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional stevenxia990430 at gmail dot com
                   ` (5 preceding siblings ...)
  2023-07-18 20:01 ` mpolacek at gcc dot gnu.org
@ 2023-07-21 17:52 ` cvs-commit at gcc dot gnu.org
  2023-12-12  0:37 ` [Bug c++/110106] [11/12/13 " cvs-commit at gcc dot gnu.org
  2023-12-12  0:38 ` [Bug c++/110106] [11/12 " mpolacek at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-21 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

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

commit r14-2717-ge36d1994051122fc6e1f8c728fbd109a59e0a822
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Jul 18 16:02:21 2023 -0400

    c++: fix ICE with is_really_empty_class [PR110106]

    is_really_empty_class is liable to crash when it gets an incomplete
    or dependent type.  Since r11-557, we pass the yet-uninstantiated
    class type S<0> of the PARM_DECL s to is_really_empty_class -- because
    of the potential_rvalue_constant_expression ->
is_rvalue_constant_expression
    change in cp_parser_constant_expression.  Here we're not parsing
    a template so we did not check COMPLETE_TYPE_P as we should.

    It should work to complete the type before checking COMPLETE_TYPE_P.

            PR c++/110106

    gcc/cp/ChangeLog:

            * constexpr.cc (potential_constant_expression_1): Try to complete
the
            type when !processing_template_decl.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/noexcept80.C: New test.

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

* [Bug c++/110106] [11/12/13 Regression] ICE on noexcept(noexcept(...)) with optional
  2023-06-03 18:18 [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional stevenxia990430 at gmail dot com
                   ` (6 preceding siblings ...)
  2023-07-21 17:52 ` cvs-commit at gcc dot gnu.org
@ 2023-12-12  0:37 ` cvs-commit at gcc dot gnu.org
  2023-12-12  0:38 ` [Bug c++/110106] [11/12 " mpolacek at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-12  0:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

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

commit r13-8148-gd44830a1364cf8cb726d59e91298a5b3077a86d9
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Jul 18 16:02:21 2023 -0400

    c++: fix ICE with is_really_empty_class [PR110106]

    is_really_empty_class is liable to crash when it gets an incomplete
    or dependent type.  Since r11-557, we pass the yet-uninstantiated
    class type S<0> of the PARM_DECL s to is_really_empty_class -- because
    of the potential_rvalue_constant_expression ->
is_rvalue_constant_expression
    change in cp_parser_constant_expression.  Here we're not parsing
    a template so we did not check COMPLETE_TYPE_P as we should.

    It should work to complete the type before checking COMPLETE_TYPE_P.

            PR c++/110106

    gcc/cp/ChangeLog:

            * constexpr.cc (potential_constant_expression_1): Try to complete
the
            type when !processing_template_decl.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/noexcept80.C: New test.

    (cherry picked from commit e36d1994051122fc6e1f8c728fbd109a59e0a822)

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

* [Bug c++/110106] [11/12 Regression] ICE on noexcept(noexcept(...)) with optional
  2023-06-03 18:18 [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional stevenxia990430 at gmail dot com
                   ` (7 preceding siblings ...)
  2023-12-12  0:37 ` [Bug c++/110106] [11/12/13 " cvs-commit at gcc dot gnu.org
@ 2023-12-12  0:38 ` mpolacek at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-12-12  0:38 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
            Summary|[11/12/13 Regression] ICE   |[11/12 Regression] ICE on
                   |on noexcept(noexcept(...))  |noexcept(noexcept(...))
                   |with optional               |with optional

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed for GCC 13+.

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

end of thread, other threads:[~2023-12-12  0:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-03 18:18 [Bug c++/110106] New: ICE on noexcept(noexcept(...)) with optional stevenxia990430 at gmail dot com
2023-06-03 18:29 ` [Bug c++/110106] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-06-03 19:31 ` pinskia at gcc dot gnu.org
2023-06-03 19:34 ` pinskia at gcc dot gnu.org
2023-06-05  6:46 ` rguenth at gcc dot gnu.org
2023-06-05 15:28 ` mpolacek at gcc dot gnu.org
2023-07-18 20:01 ` mpolacek at gcc dot gnu.org
2023-07-21 17:52 ` cvs-commit at gcc dot gnu.org
2023-12-12  0:37 ` [Bug c++/110106] [11/12/13 " cvs-commit at gcc dot gnu.org
2023-12-12  0:38 ` [Bug c++/110106] [11/12 " mpolacek 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).