This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: memcpy to an unaligned address


----Original Message----
>From: Shaun Jackman
>Sent: 03 August 2005 19:15

> On 8/3/05, Richard Henderson <rth@redhat.com> wrote:
>> It is nevertheless correct.  Examine all of the parts of the expression.
>> 
>> In particular, "&s->b".  What type does it have?  In an ideal world, it
>> would be "pointer to unaligned integer".  But we have no such type in
>> our type system, so it is "pointer to integer".  This expression is ONLY
>> THEN passed to memcpy.  At which point we query the argument for its
>> alignment, and get the non-intuitive result.
>> 
>> If you instead pass "s" to memcpy, you should get the correct unaligned
>> copy.  If that isn't happening, that's a bug.
> 
> I'm not sure I understood the last line. s is a structure,

  Not if "&s->b" makes any sense it isn't!


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]