public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10605] c++: ICE with requires-expr and -Wsequence-point [PR105304] Date: Mon, 9 May 2022 23:33:07 +0000 (GMT) [thread overview] Message-ID: <20220509233307.AA20C384B075@sourceware.org> (raw) https://gcc.gnu.org/g:9a8b7edbe65ec6350a996eab51a7c26a087e6d2b commit r10-10605-g9a8b7edbe65ec6350a996eab51a7c26a087e6d2b Author: Patrick Palka <ppalka@redhat.com> Date: Mon Apr 25 21:49:00 2022 -0400 c++: ICE with requires-expr and -Wsequence-point [PR105304] Here we're crashing from verify_sequence_points for this requires-expr condition because it contains a templated CAST_EXPR with empty operand, and verify_tree doesn't ignore this empty operand only because the manual tail recursion that it performs for unary expression trees skips the NULL test. PR c++/105304 gcc/c-family/ChangeLog: * c-common.c (verify_tree) [restart]: Move up to before the NULL test. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-requires30.C: New test. (cherry picked from commit c83b9c54d9dee2dce5d8268472a745b013d166cc) Diff: --- gcc/c-family/c-common.c | 2 +- gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 064c2f263f0..661a194fc89 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -1838,12 +1838,12 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp, enum tree_code code; enum tree_code_class cl; + restart: /* X may be NULL if it is the operand of an empty statement expression ({ }). */ if (x == NULL) return; - restart: code = TREE_CODE (x); cl = TREE_CODE_CLASS (code); diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C new file mode 100644 index 00000000000..f500af3f616 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C @@ -0,0 +1,10 @@ +// PR c++/105304 +// { dg-do compile { target c++20 } } +// { dg-additional-options "-Wall -Wsequence-point" } + +struct A { }; + +int main() { + if (requires { A(); }) + ; +}
reply other threads:[~2022-05-09 23:33 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220509233307.AA20C384B075@sourceware.org \ --to=ppalka@gcc.gnu.org \ --cc=gcc-cvs@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).