re PR c/69796 (ICE on invalid code in useless_type_conversion_p, at gimple-expr.c:83)

PR c/69796
	PR c/69974
	* c-parser.c (c_parser_translation_unit): Don't change TREE_TYPE
	of incomplete decls to error_mark_node.

	* gcc.dg/pr69796.c: New test.
	* gcc.dg/pr69974.c: New test.

From-SVN: r233861
This commit is contained in:
Jakub Jelinek 2016-03-01 19:27:21 +01:00 committed by Jakub Jelinek
parent f8e4188cae
commit 686e2237f3
5 changed files with 38 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2016-03-01 Jakub Jelinek <jakub@redhat.com>
PR c/69796
PR c/69974
* c-parser.c (c_parser_translation_unit): Don't change TREE_TYPE
of incomplete decls to error_mark_node.
2016-02-24 Marek Polacek <polacek@redhat.com>
PR c/69819

View File

@ -1436,10 +1436,7 @@ c_parser_translation_unit (c_parser *parser)
tree decl;
FOR_EACH_VEC_ELT (incomplete_record_decls, i, decl)
if (DECL_SIZE (decl) == NULL_TREE && TREE_TYPE (decl) != error_mark_node)
{
error ("storage size of %q+D isn%'t known", decl);
TREE_TYPE (decl) = error_mark_node;
}
error ("storage size of %q+D isn%'t known", decl);
}
/* Parse an external declaration (C90 6.7, C99 6.9).

View File

@ -1,3 +1,10 @@
2016-03-01 Jakub Jelinek <jakub@redhat.com>
PR c/69796
PR c/69974
* gcc.dg/pr69796.c: New test.
* gcc.dg/pr69974.c: New test.
2016-03-01 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/stack_usage3.adb: Robustify and enable for all targets.

View File

@ -0,0 +1,10 @@
/* PR c/69796 */
/* { dg-do compile } */
struct S s; /* { dg-error "storage size of 's' isn't known" } */
void
foo ()
{
s a; /* { dg-error "expression statement has incomplete type|expected" } */
}

View File

@ -0,0 +1,13 @@
/* PR c/69974 */
/* { dg-do compile } */
struct S;
char foo (struct S *);
struct S a; /* { dg-error "storage size of 'a' isn't known" } */
int b;
void
bar ()
{
b &= foo (&a);
}