This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] [RFC, GCC 4.8] Optimize conditional moves from adjacent memory locations
On Mon, 13 Feb 2012, Richard Guenther wrote:
> Indeed. But note that the transform is not valid as *this_node may cross
> a page boundary and thus either pointer load may trap if the other does not
> (well, unless the C standard (and thus our middle-end) would require that
> iff ptr->component does not trap that *ptr does not trap either - we would
> require a operand_equal_p (get_base_address ()) for both addresses).
> Joseph, can you clarify what the C standard specifies here?
The question of what the relevant objects for an access are isn't
well-defined in general, but it seems doubtful that accessing via a
structure type is valid if the whole structure isn't in accessible memory.
(Whereas you can't speculatively load from x just because x was
accessed - x might point to an array of size 1. And of course this
applies with flexible array members - access to any bit of the structure
means the part before the flexible array member is available, but the
flexible array member may not extend beyond the part accessed.)
Joseph S. Myers