PR tree-optimization/17474
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 25 Sep 2004 11:06:43 +0000 (11:06 +0000)
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 25 Sep 2004 11:06:43 +0000 (11:06 +0000)
* tree-ssa-ccp.c (maybe_fold_offset_to_component_ref): Determine
offset of the field correctly when DECL_FIELD_BIT_OFFSET != 0.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88095 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-ssa-ccp.c

index 023b449..63d2098 100644 (file)
@@ -1,6 +1,12 @@
+2004-09-25  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
+
+       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.
+
 2004-09-25  Jan Hubicka  <jh@suse.cz>
 
-       * predict.c (counts_to_freqs): Make glolbal.
+       * predict.c (counts_to_freqs): Make global.
        * predict.h (counts_to_freqa): Declare.
        * profile.c (compute_branch_probabilities): Compute frequencies
        * tree-profile.c (do_tree_profiling): Refine conditional on when
index bb37fcf..144a8bf 100644 (file)
@@ -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;