Skip to content

Commit

Permalink
PR tree-optimization/69483
Browse files Browse the repository at this point in the history
	* 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.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232833 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
jakub committed Jan 26, 2016
1 parent 5377305 commit 9bbfd06
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 9 deletions.
6 changes: 6 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions gcc/c/ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 8 additions & 9 deletions gcc/c/c-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 2 additions & 0 deletions gcc/gimple-fold.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions gcc/testsuite/g++.dg/opt/pr69483.C
Original file line number Diff line number Diff line change
@@ -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 };
6 changes: 6 additions & 0 deletions gcc/testsuite/gcc.dg/pr69483.c
Original file line number Diff line number Diff line change
@@ -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 };

0 comments on commit 9bbfd06

Please sign in to comment.