[Bug tree-optimization/88739] [7/8/9 Regression] Big-endian union bug

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 24 14:22:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #43 from Richard Biener <rguenth at gcc dot gnu.org> ---
So to get back to this - my thinking was that for a reference REF I can do

 base = get_inner_reference (ref, &bitsize, &bitpos, &offset, &mode,
&unsignedp, &reversep, &volatilep);

and get the semantically same REF building

 REF' = BIT_FIELD_REF<*(&base + offset), bitsize, bitpos>

(plus setting REF_REVERSE_STORAGE_ORDER and TREE_THIS_VOLATILE on REF').

This appearantly breaks down (similarly for get_ref_base_and_extent) for
bigendian and DECL_BIT_FIELD outer COMPONENT_REFs.  And maybe for more?

Is my expectation that the above "works" flawed?  So "bit position"
and "position of the first referenced bit" are two separate things?

get_inner_reference will basically simply funnel through arguments so
any fix to get_inner_reference/get_ref_base_and_extent will be broken
since we'll apply it "recursively" when iterating the above
BIT_FIELD_REF building.  This means it is RTL expansion that is wrong
which means my comment#31 fix is correct?  Because the issue is not
the bit position but how we interpret the underlying object?


More information about the Gcc-bugs mailing list