public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104623] [11/12 Regression] ICE in cp_parser_skip_to_pragma_eol, at cp/parser.cc:4107 Date: Tue, 15 Mar 2022 08:15:59 +0000 [thread overview] Message-ID: <bug-104623-4-ZQcYYvRIoH@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104623-4@http.gcc.gnu.org/bugzilla/> 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.
next prev parent reply other threads:[~2022-03-15 8:16 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-21 21:29 [Bug c++/104623] New: " 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 2022-03-11 14:07 ` jakub at gcc dot gnu.org 2022-03-15 8:15 ` cvs-commit at gcc dot gnu.org [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-104623-4-ZQcYYvRIoH@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).