aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorZdenek Dvorak <rakdver@gcc.gnu.org>2004-09-25 11:06:43 +0000
committerZdenek Dvorak <rakdver@gcc.gnu.org>2004-09-25 11:06:43 +0000
commitf34fa464bb843234b1ca23c752ce8cb2207b9dff (patch)
tree94519e6887d55fa32512e268b6a4a6a4262a6623 /gcc/tree-ssa-ccp.c
parent17b2e29d7058aaa466b6562c919c8ad4e235576e (diff)
downloadgcc-f34fa464bb843234b1ca23c752ce8cb2207b9dff.zip
gcc-f34fa464bb843234b1ca23c752ce8cb2207b9dff.tar.gz
gcc-f34fa464bb843234b1ca23c752ce8cb2207b9dff.tar.bz2
re PR tree-optimization/17474 (Compiling at -01 yields different results)
PR tree-optimization/17474 * tree-ssa-ccp.c (maybe_fold_offset_to_component_ref): Determine offset of the field correctly when DECL_FIELD_BIT_OFFSET != 0. From-SVN: r88095
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index bb37fcf..144a8bf 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1395,7 +1395,7 @@ static tree
maybe_fold_offset_to_component_ref (tree record_type, tree base, tree offset,
tree orig_type, bool base_is_ptr)
{
- tree f, t, field_type, tail_array_field;
+ tree f, t, field_type, tail_array_field, field_offset;
if (TREE_CODE (record_type) != RECORD_TYPE
&& TREE_CODE (record_type) != UNION_TYPE
@@ -1415,7 +1415,9 @@ maybe_fold_offset_to_component_ref (tree record_type, tree base, tree offset,
continue;
if (DECL_BIT_FIELD (f))
continue;
- if (TREE_CODE (DECL_FIELD_OFFSET (f)) != INTEGER_CST)
+
+ field_offset = byte_position (f);
+ if (TREE_CODE (field_offset) != INTEGER_CST)
continue;
/* ??? Java creates "interesting" fields for representing base classes.
@@ -1428,7 +1430,7 @@ maybe_fold_offset_to_component_ref (tree record_type, tree base, tree offset,
tail_array_field = NULL_TREE;
/* Check to see if this offset overlaps with the field. */
- cmp = tree_int_cst_compare (DECL_FIELD_OFFSET (f), offset);
+ cmp = tree_int_cst_compare (field_offset, offset);
if (cmp > 0)
continue;