public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10605] c++: ICE with requires-expr and -Wsequence-point [PR105304]
@ 2022-05-09 23:33 Patrick Palka
0 siblings, 0 replies; only message in thread
From: Patrick Palka @ 2022-05-09 23:33 UTC (permalink / raw)
To: gcc-cvs
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(); })
+ ;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-09 23:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 23:33 [gcc r10-10605] c++: ICE with requires-expr and -Wsequence-point [PR105304] Patrick Palka
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).