re PR tree-optimization/69483 (gcc ICE on x86_64-linux-gnu with "expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p")

PR tree-optimization/69483
	* gimple-fold.c (canonicalize_constructor_val): Return NULL
	if base has error_mark_node type.

	* c-parser.c (c_parser_translation_unit): Use FOR_EACH_VEC_ELT.

	* gcc.dg/pr69483.c: New test.
	* g++.dg/opt/pr69483.C: New test.

From-SVN: r232833
This commit is contained in:
Jakub Jelinek 2016-01-26 16:51:51 +01:00 committed by Jakub Jelinek
parent 9242223583
commit 13f92e8df5
7 changed files with 39 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2016-01-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/69483
* gimple-fold.c (canonicalize_constructor_val): Return NULL
if base has error_mark_node type.
2016-01-26 Christophe Lyon <christophe.lyon@linaro.org>
PR target/68620

View File

@ -1,3 +1,8 @@
2016-01-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/69483
* c-parser.c (c_parser_translation_unit): Use FOR_EACH_VEC_ELT.
2016-01-20 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
PR c/24293

View File

@ -1431,15 +1431,14 @@ c_parser_translation_unit (c_parser *parser)
while (c_parser_next_token_is_not (parser, CPP_EOF));
}
for (unsigned i = 0; i < incomplete_record_decls.length (); ++i)
{
tree decl = incomplete_record_decls[i];
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;
}
}
unsigned int i;
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;
}
}
/* Parse an external declaration (C90 6.7, C99 6.9).

View File

@ -195,6 +195,8 @@ canonicalize_constructor_val (tree cval, tree from_decl)
|| TREE_CODE (base) == FUNCTION_DECL)
&& !can_refer_decl_in_current_unit_p (base, from_decl))
return NULL_TREE;
if (TREE_TYPE (base) == error_mark_node)
return NULL_TREE;
if (TREE_CODE (base) == VAR_DECL)
TREE_ADDRESSABLE (base) = 1;
else if (TREE_CODE (base) == FUNCTION_DECL)

View File

@ -1,3 +1,9 @@
2016-01-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/69483
* gcc.dg/pr69483.c: New test.
* g++.dg/opt/pr69483.C: New test.
2016-01-26 Christophe Lyon <christophe.lyon@linaro.org>
PR target/68620

View File

@ -0,0 +1,6 @@
// PR tree-optimization/69483
// { dg-do compile }
struct T { struct S *a; };
struct S b; // { dg-error "aggregate 'S b' has incomplete type and cannot be defined" }
struct T c = { &b };

View File

@ -0,0 +1,6 @@
/* PR tree-optimization/69483 */
/* { dg-do compile } */
struct T { struct S *a; };
struct S b; /* { dg-error "storage size of 'b' isn't known" } */
struct T c = { &b };