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++/109756] "internal compiler error: tree check" when using the [[assume]] attribute with pack expansion Date: Wed, 10 May 2023 09:41:36 +0000 [thread overview] Message-ID: <bug-109756-4-UahJ082QjK@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109756-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109756 --- Comment #10 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:39d6d4256d16d676f8b9031c4d1d115ddf4ad76b commit r14-650-g39d6d4256d16d676f8b9031c4d1d115ddf4ad76b Author: Jakub Jelinek <jakub@redhat.com> Date: Wed May 10 11:37:04 2023 +0200 c++: Reject attributes without arguments used as pack expansion [PR109756] The following testcase shows we silently accept (and ignore) attributes without arguments used as pack expansions. This is because we call make_pack_expansion and that starts with if (!arg || arg == error_mark_node) return arg; Now, an attribute without arguments like [[noreturn...]] is IMHO always invalid, in this case for 2 reasons; one is that as it has no arguments, no pack can be present and second is that the standard says that attributes need to specially permit uses of parameter pack and doesn't explicitly permit it for any of the standard attributes (except for alignas? which has different syntax). If an attribute has some arguments but doesn't contain packs in those arguments, make_pack_expansion will already diagnose it. The patch also changes cp_parser_std_attribute, such that for attributes unknown to the compiler (or perhaps registered just for -Wno-attributes=) we differentiate between the attribute having no arguments (in that case we want to diagnose them when followed by ellipsis even if they are unknown, as they can't contain a pack in that case) and the case where they do have arguments but we've just skipped over those arguments because we don't know how to parse them (except that they are a balanced token sequence) - in that case we really don't know if they contain packs or not. 2023-05-10 Jakub Jelinek <jakub@redhat.com> PR c++/109756 * parser.cc (cp_parser_std_attribute): For unknown attributes with arguments set TREE_VALUE (attribute) to error_mark_node after skipping the balanced tokens. (cp_parser_std_attribute_list): If ... is used after attribute without arguments, diagnose it and return error_mark_node. If TREE_VALUE (attribute) is error_mark_node, don't call make_pack_expansion nor return early error_mark_node. * g++.dg/cpp0x/gen-attrs-78.C: New test.
prev parent reply other threads:[~2023-05-10 9:41 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-06 10:33 [Bug c++/109756] New: " ensadc at mailnesia dot com 2023-05-06 16:40 ` [Bug c++/109756] " pinskia at gcc dot gnu.org 2023-05-06 16:54 ` jakub at gcc dot gnu.org 2023-05-06 16:59 ` pinskia at gcc dot gnu.org 2023-05-06 17:00 ` pinskia at gcc dot gnu.org 2023-05-07 19:02 ` jakub at gcc dot gnu.org 2023-05-08 10:56 ` jakub at gcc dot gnu.org 2023-05-08 11:26 ` jakub at gcc dot gnu.org 2023-05-09 14:07 ` cvs-commit at gcc dot gnu.org 2023-05-09 14:10 ` cvs-commit at gcc dot gnu.org 2023-05-10 9:41 ` cvs-commit at gcc dot gnu.org [this message]
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-109756-4-UahJ082QjK@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).