diff options
author | Jeff Law <law@redhat.com> | 2013-11-14 03:18:17 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 2013-11-14 03:18:17 +0000 |
commit | b3d24ef45df6b0a343325de8ad2c337f3bf0965a (patch) | |
tree | 1544cfbc7012a5ff79694dce9e812f7babff6b8b /gcc | |
parent | e42fe7586523c8951b0fbd778c243092bfc92e1b (diff) |
PR tree-optimization/59102
* gimple-ssa-isolate-paths.c
(insert_trap_and_remove_trailing_statments): Ensure STMT is a
gimple assignment before looking at gimple_assign_lhs.
PR tree-optimization/59102
* gcc.c-torture/compile/pr59102.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@204773 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/gimple-ssa-isolate-paths.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr59102.c | 28 |
4 files changed, 45 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 91c22d3ed09..6cb12486d7e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-11-13 Jeff Law <law@redhat.com> + + PR tree-optimization/59102 + * gimple-ssa-isolate-paths.c + (insert_trap_and_remove_trailing_statments): Ensure STMT is a + gimple assignment before looking at gimple_assign_lhs. + 2013-11-13 Vladimir Makarov <vmakarov@redhat.com> * ira.c: Add comment about threads at the top of file. diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c index f9bb249436f..108b98e2917 100644 --- a/gcc/gimple-ssa-isolate-paths.c +++ b/gcc/gimple-ssa-isolate-paths.c @@ -74,9 +74,11 @@ insert_trap_and_remove_trailing_statements (gimple_stmt_iterator *si_p, tree op) LHS will be a throw-away SSA_NAME and the RHS is the NULL dereference. If the dereference is a store and we can easily transform the RHS, - then simplify the RHS to enable more DCE. */ + then simplify the RHS to enable more DCE. Note that we require the + statement to be a GIMPLE_ASSIGN which filters out calls on the RHS. */ gimple stmt = gsi_stmt (*si_p); if (walk_stmt_load_store_ops (stmt, (void *)op, NULL, check_loadstore) + && is_gimple_assign (stmt) && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (stmt)))) { /* We just need to turn the RHS into zero converted to the proper diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ddbb62eeb07..7855d7313c3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,9 @@ -2013-11-14 Tom de Vries <tom@codesourcery.com> +2013-11-13 Jeff Law <law@redhat.com> + + PR tree-optimization/59102 + * gcc.c-torture/compile/pr59102.c: New test. + +2013-11-13 Tom de Vries <tom@codesourcery.com> * gcc.dg/tail-merge-store.c: New test. @@ -7,7 +12,7 @@ * testsuite/g++.dg/plugin/selfassign.c: Include gimple-iterator.h. * testsuite/gcc.dg/plugin/selfassign.c: Likewise. -2013-11-12 Jeff Law <law@redhat.com> +2013-11-13 Jeff Law <law@redhat.com> * PR middle-end/59119 * gcc.c-torture/compile/pr59119.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr59102.c b/gcc/testsuite/gcc.c-torture/compile/pr59102.c new file mode 100644 index 00000000000..495473322a5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr59102.c @@ -0,0 +1,28 @@ + +int a, b, c, f; + +struct S +{ + int f0; +} d, *e; + +struct S +foo () +{ + b = c = b || a == 0 || f % 11; + return d; +} + +int +main () +{ + foo (); + if (b); + else + { + struct S **g = &e; + *g = 0; + *e = foo (); + } + return 0; +} |