This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ld 2.11: unaligned memory access for unions
- To: Nick Clifton <nickc at cambridge dot redhat dot com>
- Subject: Re: ld 2.11: unaligned memory access for unions
- From: Ian Lance Taylor <ian at zembu dot com>
- Date: 18 Jun 2001 15:37:36 -0700
- Cc: Eberhard Mattes <mattes at azu dot informatik dot uni-stuttgart dot de>, binutils at sources dot redhat dot com
- References: <200106151053.MAA07723@azu.informatik.uni-stuttgart.de><m3r8whu4mn.fsf@north-pole.nickc.cambridge.redhat.com>
Nick Clifton <nickc@cambridge.redhat.com> writes:
> Ah OK I understand now. The code is deliberately casting a void *
> pointer into a structure pointer, something which strictly speaking it
> should not do, since GCC then (reasonably) assumes that the pointer is
> aligned as required for the structure type.
I don't understand.
The external structure has only char[] fields, so gcc should not make
any alignment assumptions.
The internal structure should be aligned appropriately any place where
BFD uses it. If it is not, where is it being used? Why is it not
aligned?
Ian