From: Zdenek Dvorak Date: Sat, 25 Sep 2004 11:06:43 +0000 (+0000) Subject: re PR tree-optimization/17474 (Compiling at -01 yields different results) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f34fa464bb843234b1ca23c752ce8cb2207b9dff;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 023b449ed37..63d20983690 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ +2004-09-25 Zdenek Dvorak + + 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 - * 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 diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index bb37fcf0967..144a8bfaeb0 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;