re PR tree-optimization/17474 (Compiling at -01 yields different results)
authorZdenek Dvorak <rakdver@gcc.gnu.org>
Sat, 25 Sep 2004 11:06:43 +0000 (11:06 +0000)
committerZdenek Dvorak <rakdver@gcc.gnu.org>
Sat, 25 Sep 2004 11:06:43 +0000 (11:06 +0000)
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

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

index 023b449ed37008408bb99f703398f69ffc9c8322..63d20983690bfe56c7391a2140d0c6ef69bbcc5d 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 bb37fcf09670fceacbab13cb732a31d794009107..144a8bfaeb0e1bd027e92114c2815476ea4ec361 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;