diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-01-26 16:51:51 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-01-26 16:51:51 +0100 |
commit | 13f92e8df561c41de9f7f3ed9aa25bf963ab8f20 (patch) | |
tree | 9b9363d416df028970358fd729441f699db6d442 /gcc | |
parent | 9242223583dde373111fd39fbcff9cc06abefe6f (diff) | |
download | gcc-13f92e8df561c41de9f7f3ed9aa25bf963ab8f20.zip gcc-13f92e8df561c41de9f7f3ed9aa25bf963ab8f20.tar.gz gcc-13f92e8df561c41de9f7f3ed9aa25bf963ab8f20.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 17 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr69483.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr69483.c | 6 |
7 files changed, 39 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a8f68e7..37a3782 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 5577518..7d6250e 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -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 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index efac47b..eede3a7 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -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). diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 70871cf..eb130d0 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 033faa3..3d0cc30 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/opt/pr69483.C b/gcc/testsuite/g++.dg/opt/pr69483.C new file mode 100644 index 0000000..866aba8 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr69483.C @@ -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 }; diff --git a/gcc/testsuite/gcc.dg/pr69483.c b/gcc/testsuite/gcc.dg/pr69483.c new file mode 100644 index 0000000..2ab9dc3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr69483.c @@ -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 }; |