diff options
author | Richard Guenther <rguenther@suse.de> | 2010-09-23 11:00:27 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-09-23 11:00:27 +0000 |
commit | dca267461a4ec936658e9dccdb952a2ca4b9f3e4 (patch) | |
tree | e44e86d90275e1bd95ec240c0b97e8b9f05d5f35 /gcc | |
parent | 030ef1fba5d03893d6cd2ae86395aadb76d788b7 (diff) | |
download | gcc-dca267461a4ec936658e9dccdb952a2ca4b9f3e4.zip gcc-dca267461a4ec936658e9dccdb952a2ca4b9f3e4.tar.gz gcc-dca267461a4ec936658e9dccdb952a2ca4b9f3e4.tar.bz2 |
re PR tree-optimization/45750 (ICE: in iterative_hash_expr, at tree.c:6831 on invalid code)
2010-09-23 Richard Guenther <rguenther@suse.de>
PR middle-end/45750
* gimplify.c (gimplify_expr): Properly pass on GS_ERROR when
gimplifying MEM_REF.
* gcc.dg/pr45750.c: New testcase.
From-SVN: r164555
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimplify.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr45750.c | 16 |
4 files changed, 32 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3f2e66f..4b5294c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-09-23 Richard Guenther <rguenther@suse.de> + + PR middle-end/45750 + * gimplify.c (gimplify_expr): Properly pass on GS_ERROR when + gimplifying MEM_REF. + 2010-09-23 Alan Modra <amodra@gmail.com> * config/rs6000/rs6000.c (toc_relative_ok): Delete. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 4e6a037..994ffde 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6809,8 +6809,10 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, is_gimple_reg, fb_rvalue); - recalculate_side_effects (*expr_p); + if (ret == GS_ERROR) + break; + recalculate_side_effects (*expr_p); *expr_p = fold_build2_loc (input_location, MEM_REF, TREE_TYPE (*expr_p), TREE_OPERAND (*expr_p, 0), @@ -6835,6 +6837,8 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, } ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, is_gimple_mem_ref_addr, fb_rvalue); + if (ret == GS_ERROR) + break; recalculate_side_effects (*expr_p); ret = GS_ALL_DONE; break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e102d03..050e571 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-09-23 Richard Guenther <rguenther@suse.de> + + PR middle-end/45750 + * gcc.dg/pr45750.c: New testcase. + 2010-09-23 Jakub Jelinek <jakub@redhat.com> * gcc.dg/torture/stackalign/alloca-4.c: Remove -m32 from dg-options. diff --git a/gcc/testsuite/gcc.dg/pr45750.c b/gcc/testsuite/gcc.dg/pr45750.c new file mode 100644 index 0000000..22c471b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr45750.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +struct S +{ + int i; +}; + +int invalid[] = 0; /* { dg-error "invalid initializer" } */ + +void foo (void) +{ + if (((struct S *)undeclared)->i); /* { dg-error "undeclared" } */ +} + +/* { dg-message "reported only once" "" { target *-*-* } 13 } */ |