* [Bug c++/104623] [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107
2022-02-21 21:29 [Bug c++/104623] New: [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107 gscfq@t-online.de
@ 2022-02-22 1:19 ` pinskia at gcc dot gnu.org
2022-02-22 10:31 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-22 1:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104623
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/104623] [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107
2022-02-21 21:29 [Bug c++/104623] New: [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107 gscfq@t-online.de
2022-02-22 1:19 ` [Bug c++/104623] " pinskia at gcc dot gnu.org
@ 2022-02-22 10:31 ` rguenth at gcc dot gnu.org
2022-02-22 19:23 ` mpolacek at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-22 10:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104623
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/104623] [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107
2022-02-21 21:29 [Bug c++/104623] New: [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107 gscfq@t-online.de
2022-02-22 1:19 ` [Bug c++/104623] " pinskia at gcc dot gnu.org
2022-02-22 10:31 ` rguenth at gcc dot gnu.org
@ 2022-02-22 19:23 ` mpolacek at gcc dot gnu.org
2022-02-22 19:28 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-02-22 19:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104623
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-02-22
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
CC| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r11-2106-gf0d0be62db5ba030283fa8189211830d09dfb467
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/104623] [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107
2022-02-21 21:29 [Bug c++/104623] New: [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107 gscfq@t-online.de
` (2 preceding siblings ...)
2022-02-22 19:23 ` mpolacek at gcc dot gnu.org
@ 2022-02-22 19:28 ` mpolacek at gcc dot gnu.org
2022-03-11 14:07 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-02-22 19:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104623
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Looks like a missing CPP_PRAGMA_EOL.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/104623] [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107
2022-02-21 21:29 [Bug c++/104623] New: [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107 gscfq@t-online.de
` (3 preceding siblings ...)
2022-02-22 19:28 ` mpolacek at gcc dot gnu.org
@ 2022-03-11 14:07 ` jakub at gcc dot gnu.org
2022-03-15 8:15 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-11 14:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104623
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 52607
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52607&action=edit
gcc12-pr104623.patch
The problem is that the function purges the tokens, from the token after
CPP_PRAGMA until CPP_PRAGMA_EOL (the latter inclusive). But CPP_PRAGMA is not
purged. So, next time we tentatively parse it we ICE because CPP_PRAGMA isn't
followed by CPP_PRAGMA_EOL anymore (because purged tokens are ignored).
I have tried various things, purging also the pragma_tok token or changing
second argument of cp_parser_skip_to_pragma_eol to NULL in
cp_parser_skip_to_end_of_statement and
cp_parser_skip_to_end_of_block_or_statement but both regressed various
testcases.
This at least in quick check-g++ testing didn't regress anything.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/104623] [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107
2022-02-21 21:29 [Bug c++/104623] New: [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107 gscfq@t-online.de
` (4 preceding siblings ...)
2022-03-11 14:07 ` jakub at gcc dot gnu.org
@ 2022-03-15 8:15 ` cvs-commit at gcc dot gnu.org
2022-03-15 8:20 ` [Bug c++/104623] [11 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-15 8:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104623
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:efd1582926f3278a5e57ebab7d87fc870f06ecea
commit r12-7652-gefd1582926f3278a5e57ebab7d87fc870f06ecea
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Mar 15 09:15:27 2022 +0100
c++: Fix up cp_parser_skip_to_pragma_eol [PR104623]
We ICE on the following testcase, because we tentatively parse it multiple
times and the erroneous attribute syntax results in
cp_parser_skip_to_end_of_statement, which when seeing CPP_PRAGMA (can be
any deferred one, OpenMP/OpenACC/ivdep etc.) it calls
cp_parser_skip_to_pragma_eol, which calls cp_lexer_purge_tokens_after.
That call purges all the tokens from CPP_PRAGMA until CPP_PRAGMA_EOL,
excluding the initial CPP_PRAGMA though (but including the final
CPP_PRAGMA_EOL). This means the second time we parse this, we see
CPP_PRAGMA with no tokens after it from the pragma, most importantly
not the CPP_PRAGMA_EOL, so either if it is the last pragma in the TU,
we ICE, or if there are other pragmas we treat everything in between
as a pragma.
I've tried various things, including making the CPP_PRAGMA token
itself also purged, or changing the cp_parser_skip_to_end_of_statement
(and cp_parser_skip_to_end_of_block_or_statement) to call it with
NULL instead of token, so that this purging isn't done there,
but each patch resulted in lots of regressions.
But removing the purging altogether surprisingly doesn't regress anything,
and I think it is the right thing, if we e.g. parse tentatively, why can't
we parse the pragma multiple times or at least skip over it?
2022-03-15 Jakub Jelinek <jakub@redhat.com>
PR c++/104623
* parser.cc (cp_parser_skip_to_pragma_eol): Don't purge any tokens.
* g++.dg/gomp/pr104623.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/104623] [11 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107
2022-02-21 21:29 [Bug c++/104623] New: [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107 gscfq@t-online.de
` (5 preceding siblings ...)
2022-03-15 8:15 ` cvs-commit at gcc dot gnu.org
@ 2022-03-15 8:20 ` jakub at gcc dot gnu.org
2022-04-21 7:51 ` rguenth at gcc dot gnu.org
2023-05-29 10:06 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-15 8:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104623
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12 Regression] ICE in |[11 Regression] ICE in
|cp_parser_skip_to_pragma_eo |cp_parser_skip_to_pragma_eo
|l, at cp/parser.cc:4107 |l, at cp/parser.cc:4107
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.
It is ice-on-invalid-code, so I'm a hesistant to backport this.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/104623] [11 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107
2022-02-21 21:29 [Bug c++/104623] New: [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107 gscfq@t-online.de
` (6 preceding siblings ...)
2022-03-15 8:20 ` [Bug c++/104623] [11 " jakub at gcc dot gnu.org
@ 2022-04-21 7:51 ` rguenth at gcc dot gnu.org
2023-05-29 10:06 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21 7:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104623
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.3 |11.4
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/104623] [11 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107
2022-02-21 21:29 [Bug c++/104623] New: [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107 gscfq@t-online.de
` (7 preceding siblings ...)
2022-04-21 7:51 ` rguenth at gcc dot gnu.org
@ 2023-05-29 10:06 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-29 10:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104623
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.4 |11.5
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.4 is being released, retargeting bugs to GCC 11.5.
^ permalink raw reply [flat|nested] 10+ messages in thread