summaryrefslogtreecommitdiff
path: root/gcc/c-parse.in
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-28 19:35:26 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-28 19:35:26 +0000
commit5cbd179d875444116e92838078534bcf689ccff3 (patch)
tree5fc1cb98a75ae0a4738fa2fd992b53aee46095a7 /gcc/c-parse.in
parent0ecedb6fdf659f79d6d35c973874a5c502982ed3 (diff)
downloadgcc-5cbd179d875444116e92838078534bcf689ccff3.tar.gz
PR c/16409
* c-decl.c (start_decl): Check for initializing incomplete array of VLAs. (build_compound_literal): Check for TYPE being error_mark_node. * c-parse.in (primary): Check for VLA compound literals. testsuite: * gcc.dg/vla-init-2.c, gcc.dg/vla-init-3.c, gcc.dg/vla-init-4.c, gcc.dg/vla-init-5.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88248 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r--gcc/c-parse.in5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index 6fcf66739f5..87dfc100748 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -677,6 +677,11 @@ primary:
| '(' typename ')' '{'
{ start_init (NULL_TREE, NULL, 0);
$<ttype>$ = groktypename ($2);
+ if (C_TYPE_VARIABLE_SIZE ($<ttype>$))
+ {
+ error ("compound literal has variable size");
+ $<ttype>$ = error_mark_node;
+ }
really_start_incremental_init ($<ttype>$); }
initlist_maybe_comma '}' %prec UNARY
{ struct c_expr init = pop_init_level (0);