public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100055] New: ICE on invalid requires expression
@ 2021-04-12 23:10 ldalessandro at gmail dot com
  2021-04-22 16:35 ` [Bug c++/100055] " mpolacek at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: ldalessandro at gmail dot com @ 2021-04-12 23:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100055
           Summary: ICE on invalid requires expression
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

The following invalid code triggers a segfault.

```
void foo(auto&& arg) requires({});


<source>:1:30: error: statement-expressions are not allowed outside functions
nor in template-argument lists
    1 | void foo(auto&& arg) requires({});
      |                              ^
<source>:1:33: internal compiler error: Segmentation fault
    1 | void foo(auto&& arg) requires({});
      |                                 ^
0x1d01009 internal_error(char const*, ...)
        ???:0
0x7a1b17 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ???:0
0x7a7a78 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ???:0
0x8e230d c_parse_file()
        ???:0
0xa615b2 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
```

live example: https://godbolt.org/z/qjWWWchjo

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

* [Bug c++/100055] ICE on invalid requires expression
  2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
@ 2021-04-22 16:35 ` mpolacek at gcc dot gnu.org
  2021-04-22 16:41 ` [Bug c++/100055] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-22 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2021-04-22

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed, thanks for the report.

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

* [Bug c++/100055] [10/11/12 Regression] ICE on invalid requires expression
  2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
  2021-04-22 16:35 ` [Bug c++/100055] " mpolacek at gcc dot gnu.org
@ 2021-04-22 16:41 ` mpolacek at gcc dot gnu.org
  2021-04-22 17:32 ` hewillk at gmail dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-22 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
            Summary|ICE on invalid requires     |[10/11/12 Regression] ICE
                   |expression                  |on invalid requires
                   |                            |expression
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
           Priority|P3                          |P4
   Target Milestone|---                         |10.4

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This is probably sufficient:

--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9695,7 +9695,7 @@ grokfndecl (tree ctype,
       bool memtmpl = (!block_local
              && (processing_template_decl
              > template_class_depth (ctx)));
-      if (memtmpl)
+      if (memtmpl && current_template_parms)
         tmpl_reqs = TEMPLATE_PARMS_CONSTRAINTS (current_template_parms);
       tree ci = build_constraints (tmpl_reqs, decl_reqs);
       if (concept_p && ci)

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

* [Bug c++/100055] [10/11/12 Regression] ICE on invalid requires expression
  2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
  2021-04-22 16:35 ` [Bug c++/100055] " mpolacek at gcc dot gnu.org
  2021-04-22 16:41 ` [Bug c++/100055] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
@ 2021-04-22 17:32 ` hewillk at gmail dot com
  2021-04-26 14:51 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hewillk at gmail dot com @ 2021-04-22 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

康桓瑋 <hewillk at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hewillk at gmail dot com

--- Comment #3 from 康桓瑋 <hewillk at gmail dot com> ---
I think this is a dup of PR 99465, which has several ICE forms.

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

* [Bug c++/100055] [10/11/12 Regression] ICE on invalid requires expression
  2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-22 17:32 ` hewillk at gmail dot com
@ 2021-04-26 14:51 ` mpolacek at gcc dot gnu.org
  2021-05-03 16:48 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-26 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99465#c1 but not
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99465#c0.

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

* [Bug c++/100055] [10/11/12 Regression] ICE on invalid requires expression
  2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
                   ` (3 preceding siblings ...)
  2021-04-26 14:51 ` mpolacek at gcc dot gnu.org
@ 2021-05-03 16:48 ` cvs-commit at gcc dot gnu.org
  2021-05-03 16:49 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-03 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r12-389-gc9b6890d0b6aa030b307fdb620f8c53ed59ca3b5
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Apr 22 17:32:01 2021 -0400

    c++: Fix ICE with invalid requires-expression [PR100055]

    This fixes a crash on invalid requires-expression: in this test,
    current_template_parms is null so accessing TEMPLATE_PARMS_CONSTRAINTS
    is going to fail.  So don't crash, but make sure we've complained
    already.

    gcc/cp/ChangeLog:

            PR c++/100055
            * decl.c (grokfndecl): Check current_template_parms.

    gcc/testsuite/ChangeLog:

            PR c++/100055
            * g++.dg/concepts/diagnostic18.C: New test.

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

* [Bug c++/100055] [10/11/12 Regression] ICE on invalid requires expression
  2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
                   ` (4 preceding siblings ...)
  2021-05-03 16:48 ` cvs-commit at gcc dot gnu.org
@ 2021-05-03 16:49 ` mpolacek at gcc dot gnu.org
  2021-11-12 21:23 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-05-03 16:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed for GCC 12.

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

* [Bug c++/100055] [10/11/12 Regression] ICE on invalid requires expression
  2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
                   ` (5 preceding siblings ...)
  2021-05-03 16:49 ` mpolacek at gcc dot gnu.org
@ 2021-11-12 21:23 ` pinskia at gcc dot gnu.org
  2022-01-04  2:23 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-12 21:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lts-rudolph at gmx dot de

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 96111 has been marked as a duplicate of this bug. ***

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

* [Bug c++/100055] [10/11/12 Regression] ICE on invalid requires expression
  2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
                   ` (6 preceding siblings ...)
  2021-11-12 21:23 ` pinskia at gcc dot gnu.org
@ 2022-01-04  2:23 ` pinskia at gcc dot gnu.org
  2022-01-04  2:24 ` pinskia at gcc dot gnu.org
  2022-01-04  2:26 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-04  2:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |12.0

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

* [Bug c++/100055] [10/11/12 Regression] ICE on invalid requires expression
  2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
                   ` (7 preceding siblings ...)
  2022-01-04  2:23 ` pinskia at gcc dot gnu.org
@ 2022-01-04  2:24 ` pinskia at gcc dot gnu.org
  2022-01-04  2:26 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-04  2:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nico at josuttis dot de

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 98635 has been marked as a duplicate of this bug. ***

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

* [Bug c++/100055] [10/11/12 Regression] ICE on invalid requires expression
  2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
                   ` (8 preceding siblings ...)
  2022-01-04  2:24 ` pinskia at gcc dot gnu.org
@ 2022-01-04  2:26 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-04  2:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 99465 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2022-01-04  2:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 23:10 [Bug c++/100055] New: ICE on invalid requires expression ldalessandro at gmail dot com
2021-04-22 16:35 ` [Bug c++/100055] " mpolacek at gcc dot gnu.org
2021-04-22 16:41 ` [Bug c++/100055] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
2021-04-22 17:32 ` hewillk at gmail dot com
2021-04-26 14:51 ` mpolacek at gcc dot gnu.org
2021-05-03 16:48 ` cvs-commit at gcc dot gnu.org
2021-05-03 16:49 ` mpolacek at gcc dot gnu.org
2021-11-12 21:23 ` pinskia at gcc dot gnu.org
2022-01-04  2:23 ` pinskia at gcc dot gnu.org
2022-01-04  2:24 ` pinskia at gcc dot gnu.org
2022-01-04  2:26 ` pinskia 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).