aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2008-11-05 17:06:38 +0100
committerMartin Jambor <jamborm@gcc.gnu.org>2008-11-05 17:06:38 +0100
commit5e9abf2ce4a4e1e380a1da8016eac24b22973dfd (patch)
tree519533d92b35a2c870dadff443e7d0905b988f61 /gcc/tree-ssa-forwprop.c
parent8df7b2b60e8d304998ae7b487e8981c9cc30040a (diff)
downloadgcc-5e9abf2ce4a4e1e380a1da8016eac24b22973dfd.zip
gcc-5e9abf2ce4a4e1e380a1da8016eac24b22973dfd.tar.gz
gcc-5e9abf2ce4a4e1e380a1da8016eac24b22973dfd.tar.bz2
re PR middle-end/37861 (Bogus array bounds warning)
2008-11-05 Martin Jambor <mjambor@suse.cz> PR middle-end/37861 * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Don't turn pointer arithmetics into array_ref if the array is accessed through an indirect_ref. * testsuite/gcc.dg/Warray-bounds-5.c: New file. * testsuite/gcc.dg/Warray-bounds-6.c: New file. From-SVN: r141613
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index a04e7ca..5626b10 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -802,6 +802,9 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
array_ref = TREE_OPERAND (def_rhs, 0);
if (TREE_CODE (array_ref) != ARRAY_REF
|| TREE_CODE (TREE_TYPE (TREE_OPERAND (array_ref, 0))) != ARRAY_TYPE
+ /* Avoid accessing hidden multidimensional arrays in this way or VRP
+ might give out bogus warnings (see PR 37861) */
+ || TREE_CODE (TREE_OPERAND (array_ref, 0)) == INDIRECT_REF
|| !integer_zerop (TREE_OPERAND (array_ref, 1)))
return false;