mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 03:40:26 +08:00
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.
This commit is contained in:
parent
0344b5b822
commit
9f7d77bd6d
@ -5402,7 +5402,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);
|
||||
|
12
gcc/testsuite/gcc.dg/pr99990.c
Normal file
12
gcc/testsuite/gcc.dg/pr99990.c
Normal file
@ -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" } */
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user