public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r9-9444] c: Avoid clobbering TREE_TYPE (error_mark_node) [PR99990]
@ 2021-04-20 23:34 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-04-20 23:34 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9861f00a08a5f5fecd2c1c4135d3d540b0ed9cc7
commit r9-9444-g9861f00a08a5f5fecd2c1c4135d3d540b0ed9cc7
Author: Jakub Jelinek <jakub@redhat.com>
Date: Sat Apr 10 17:01:54 2021 +0200
c: Avoid clobbering TREE_TYPE (error_mark_node) [PR99990]
The following testcase ICEs during error recovery, because finish_decl
overwrites TREE_TYPE (error_mark_node), which better should stay always
to be error_mark_node.
2021-04-10 Jakub Jelinek <jakub@redhat.com>
PR c/99990
* c-decl.c (finish_decl): Don't overwrite TREE_TYPE of
error_mark_node.
* gcc.dg/pr99990.c: New test.
(cherry picked from commit 91e076f3a66c1c9f6aa51e9d53d07803606e3bf1)
Diff:
---
gcc/c/c-decl.c | 2 +-
gcc/testsuite/gcc.dg/pr99990.c | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 80071112130..e1e765e29e9 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -5180,7 +5180,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
gcc_unreachable ();
}
- if (DECL_INITIAL (decl))
+ if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node)
TREE_TYPE (DECL_INITIAL (decl)) = type;
relayout_decl (decl);
diff --git a/gcc/testsuite/gcc.dg/pr99990.c b/gcc/testsuite/gcc.dg/pr99990.c
new file mode 100644
index 00000000000..6878b00ce0d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr99990.c
@@ -0,0 +1,12 @@
+/* PR c/99990 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#include <stdarg.h>
+
+void
+foo ()
+{
+ va_arg (0, long); /* { dg-error "first argument to 'va_arg' not of type 'va_list'" } */
+ void *b[] = 0; /* { dg-error "invalid initializer" } */
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-20 23:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 23:34 [gcc r9-9444] c: Avoid clobbering TREE_TYPE (error_mark_node) [PR99990] Jakub Jelinek
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).