re PR middle-end/19807 (fold does not fold &a[4]-1)
authorRichard Guenther <rguenth@gcc.gnu.org>
Wed, 11 May 2005 08:14:44 +0000 (08:14 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 11 May 2005 08:14:44 +0000 (08:14 +0000)
commitc554294001d28360a26956e7508231fca94f3074
tree1f93266ba272ee270a6ad7b854a342625fa9c228
parent8a29ce604bdb9588fa66aaabe27c92bf955cab3d
re PR middle-end/19807 (fold does not fold &a[4]-1)

2005-05-11  Richard Guenther  <rguenth@gcc.gnu.org>

PR middle-end/19807
PR tree-optimization/19639
* fold-const.c (try_move_mult_to_index): Handle INTEGER_CST
and generic summands for char* as s * delta, too, folding &a[i]
CODE x to &a[i CODE x/s].  Use tree_int_cst_equal
for comparison of steps.  Convert types for index addition.
(fold_binary): Adjust the callers to always dispatch to
try_move_mult_to_index.
* tree-ssa-propagate.c (set_rhs): Avoid setting rhs to
expr with non-gimple ARRAY_REF offset.

* g++.dg/tree-ssa/pr19807.C: New testcase.

From-SVN: r99568
gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/pr19807.C [new file with mode: 0644]
gcc/tree-ssa-propagate.c