Commit d915eec0 by Jakub Jelinek Committed by Jakub Jelinek

re PR c/14069 (This input file lets gcc crash)

	PR c/14069
	* c-decl.c (finish_struct): Change type of incorrect flexible array
	field into error_mark_node.

	* gcc.dg/20040322-1.c: New test.

From-SVN: r79832
parent 19a03303
2004-03-22 Jakub Jelinek <jakub@redhat.com>
PR c/14069
* c-decl.c (finish_struct): Change type of incorrect flexible array
field into error_mark_node.
2004-03-22 Andrew Pinski <pinskia@physics.uc.edu>
PR target/14580
......
......@@ -5018,11 +5018,20 @@ finish_struct (tree t, tree fieldlist, tree attributes)
&& TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (x))) == NULL_TREE)
{
if (TREE_CODE (t) == UNION_TYPE)
error ("%Jflexible array member in union", x);
{
error ("%Jflexible array member in union", x);
TREE_TYPE (x) = error_mark_node;
}
else if (TREE_CHAIN (x) != NULL_TREE)
error ("%Jflexible array member not at end of struct", x);
{
error ("%Jflexible array member not at end of struct", x);
TREE_TYPE (x) = error_mark_node;
}
else if (! saw_named_field)
error ("%Jflexible array member in otherwise empty struct", x);
{
error ("%Jflexible array member in otherwise empty struct", x);
TREE_TYPE (x) = error_mark_node;
}
}
if (pedantic && TREE_CODE (t) == RECORD_TYPE
......
2004-03-22 Jakub Jelinek <jakub@redhat.com>
PR c/14069
* gcc.dg/20040322-1.c: New test.
2004-03-22 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/ultrasp2.c: Do not pass -m64. Remove redundant lines.
......
/* PR c/14069 */
/* { dg-do compile } */
struct S { int a; char b[]; char *c; }; /* { dg-error "error" "flexible array member not" } */
struct S s = { .b = "foo", .c = .b }; /* { dg-error "error" "parse error before" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment