+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
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
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.
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;