public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94480] New: ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858
@ 2020-04-03 20:26 asolokha at gmx dot com
  2020-04-04  9:48 ` [Bug c++/94480] [10 Regression] " marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: asolokha at gmx dot com @ 2020-04-03 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94480
           Summary: ICE in cp_parser_abort_tentative_parse, at
                    cp/parser.c:31858
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++-10.0.1-alpha20200329 snapshot (g:60c254b279e8e8443b8ad26cc46b9e4084cff66c)
ICEs when compiling the following testcase, extracted from
test/CXX/expr/expr.prim/expr.prim.req/requires-expr.cpp from the clang 10.0.0
test suite, w/ -fconcepts:

template<typename T, typename U>
constexpr bool is_same_v = false;

static_assert(is_same_v<bool, decltype(requires { requires false; })>);

% g++-10.0.1 -fconcepts -c nn8nrioc.cpp
nn8nrioc.cpp:4:60: note: the expression 'false' evaluated to 'false'
    4 | static_assert(is_same_v<bool, decltype(requires { requires false; })>);
      |                                                   ~~~~~~~~~^~~~~
nn8nrioc.cpp:4:67: internal compiler error: in cp_parser_abort_tentative_parse,
at cp/parser.c:31858
    4 | static_assert(is_same_v<bool, decltype(requires { requires false; })>);
      |                                                                   ^
0x63c536 cp_parser_abort_tentative_parse
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:31858
0x63c536 cp_parser_abort_tentative_parse
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:31856
0x9a9b4f cp_parser_decltype_expr
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:14832
0x9a9b4f cp_parser_decltype
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:14920
0x9b34ef cp_parser_simple_type_specifier
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:18008
0x996e45 cp_parser_type_specifier
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:17784
0x9aca80 cp_parser_type_specifier_seq
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:22385
0x9a53c7 cp_parser_type_id_1
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:22202
0x9a82e3 cp_parser_template_type_arg
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:22293
0x9acc1f cp_parser_template_argument
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:17181
0x9acc1f cp_parser_template_argument_list
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:17092
0x9acc1f cp_parser_enclosed_template_argument_list
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:29761
0x9adf60 cp_parser_template_id
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:16664
0x9ae62a cp_parser_class_name
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:23696
0x9aa385 cp_parser_qualifying_entity
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:6773
0x9aa385 cp_parser_nested_name_specifier_opt
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:6455
0x9b2f59 cp_parser_simple_type_specifier
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:18126
0x9a83ea cp_parser_postfix_expression
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:7173
0x98a669 cp_parser_binary_expression
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:9554
0x98c31e cp_parser_assignment_expression
       
/var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200329/work/gcc-10-20200329/gcc/cp/parser.c:9859

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

* [Bug c++/94480] [10 Regression] ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858
  2020-04-03 20:26 [Bug c++/94480] New: ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858 asolokha at gmx dot com
@ 2020-04-04  9:48 ` marxin at gcc dot gnu.org
  2020-04-04 13:57 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-04  9:48 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE in                      |[10 Regression] ICE in
                   |cp_parser_abort_tentative_p |cp_parser_abort_tentative_p
                   |arse, at cp/parser.c:31858  |arse, at cp/parser.c:31858
     Ever confirmed|0                           |1
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2020-04-04
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r10-4424-g81a34a6b68184436.

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

* [Bug c++/94480] [10 Regression] ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858
  2020-04-03 20:26 [Bug c++/94480] New: ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858 asolokha at gmx dot com
  2020-04-04  9:48 ` [Bug c++/94480] [10 Regression] " marxin at gcc dot gnu.org
@ 2020-04-04 13:57 ` jakub at gcc dot gnu.org
  2020-04-07 16:00 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-04 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |10.0

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

* [Bug c++/94480] [10 Regression] ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858
  2020-04-03 20:26 [Bug c++/94480] New: ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858 asolokha at gmx dot com
  2020-04-04  9:48 ` [Bug c++/94480] [10 Regression] " marxin at gcc dot gnu.org
  2020-04-04 13:57 ` jakub at gcc dot gnu.org
@ 2020-04-07 16:00 ` ppalka at gcc dot gnu.org
  2020-04-07 19:23 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-04-07 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/94480] [10 Regression] ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858
  2020-04-03 20:26 [Bug c++/94480] New: ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2020-04-07 16:00 ` ppalka at gcc dot gnu.org
@ 2020-04-07 19:23 ` ppalka at gcc dot gnu.org
  2020-04-08  5:10 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-04-07 19:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Reduced rejects-valid testcase:

  decltype(requires { 1; }) b;



This is probably caused by commit 3ec8ee2e0f0b0508ca9dcc7b99f8e79015efd600 on
the concepts branch:

commit 3ec8ee2e0f0b0508ca9dcc7b99f8e79015efd600
Date:   Fri Jul 12 17:04:02 2019 -0400

      * parser.c (cp_parser_requires_expression): Commit to the tentative
parse.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 9e6cad6ce91..ea24fe1da6b 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -27203,6 +27203,9 @@ cp_parser_requires_expression (cp_parser *parser)
       return error_mark_node;
     }

+  /* This is definitely a requires-expression.  */
+  cp_parser_commit_to_tentative_parse (parser);
+
   tree parms, reqs;
   {
     /* Local parameters are delared as variables within the scope


Or at least, removing this call fixes the ICE, and doesn't seem to introduce
any testsuite regressions.  I wonder what we need this call to
cp_parser_commit_to_tentative_parse for?  I ran a bunch of frontend/library
testsuite tests with the above call replaced with a 

  gcc_assert (!cp_parser_uncommitted_to_tentative_parse_p (parser));

and I couldn't get the assert to fail in any of the existing testsuite tests I
tried.  The assert of course fails for the testcase in this PR though.

Unassigning myself since I don't think I understand the tentative parsing stuff
here enough to resolve this.

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

* [Bug c++/94480] [10 Regression] ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858
  2020-04-03 20:26 [Bug c++/94480] New: ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2020-04-07 19:23 ` ppalka at gcc dot gnu.org
@ 2020-04-08  5:10 ` jason at gcc dot gnu.org
  2020-04-08  5:12 ` cvs-commit at gcc dot gnu.org
  2020-04-08  5:16 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2020-04-08  5:10 UTC (permalink / raw)
  To: gcc-bugs

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

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++/94480] [10 Regression] ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858
  2020-04-03 20:26 [Bug c++/94480] New: ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2020-04-08  5:10 ` jason at gcc dot gnu.org
@ 2020-04-08  5:12 ` cvs-commit at gcc dot gnu.org
  2020-04-08  5:16 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-08  5:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:845d451e1f73d8a9a84382c3c6d4fca9c8220403

commit r10-7612-g845d451e1f73d8a9a84382c3c6d4fca9c8220403
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 7 00:45:26 2020 -0400

    c++: requires-expression and tentative parse [PR94480]

    The problem here was that cp_parser_requires_expression committing to a
    tentative parse confused cp_parser_decltype_expr, which needs to still be
    tentative.  The only reason to commit here is to get syntax errors within
    the requires-expression, which we can still do when the commit is
firewalled
    from the enclosing context.

    gcc/cp/ChangeLog
    2020-04-07  Jason Merrill  <jason@redhat.com>

            PR c++/94480
            * parser.c (cp_parser_requires_expression): Use tentative_firewall.

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

* [Bug c++/94480] [10 Regression] ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858
  2020-04-03 20:26 [Bug c++/94480] New: ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858 asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2020-04-08  5:12 ` cvs-commit at gcc dot gnu.org
@ 2020-04-08  5:16 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2020-04-08  5:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-04-08  5:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 20:26 [Bug c++/94480] New: ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858 asolokha at gmx dot com
2020-04-04  9:48 ` [Bug c++/94480] [10 Regression] " marxin at gcc dot gnu.org
2020-04-04 13:57 ` jakub at gcc dot gnu.org
2020-04-07 16:00 ` ppalka at gcc dot gnu.org
2020-04-07 19:23 ` ppalka at gcc dot gnu.org
2020-04-08  5:10 ` jason at gcc dot gnu.org
2020-04-08  5:12 ` cvs-commit at gcc dot gnu.org
2020-04-08  5:16 ` 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).