This is the mail archive of the
mailing list for the GCC project.
Re: Structure Alignment Bug in Sparc.
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: Nitin Gupta <ngupta at GlobespanVirata dot com>
- Cc: Richard Henderson <rth at redhat dot com>, gcc-bug at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Tue, 19 Aug 2003 15:51:42 +0100
- Subject: Re: Structure Alignment Bug in Sparc.
- Organization: Codesourcery LLC
- References: <IDEAKDGJLGFCFODOJGGICEFCCHAA.firstname.lastname@example.org>
Nitin Gupta wrote:
A structure assignment statement of a struct
containing a 8 byte member causes a ldd assembly
instruction to be generated.
Ok... Why do you think this is a bug?
What causes compiler to assume that if a structure contains
"long long" (64 bit) member any where (and not as the first member)
then the start of the sturct will also be aligned a 8 byte boundary.
because it will be (if it were not so, the long long's alignment
could not be guaranteed)
Err.. I think the assumption is that malloc will allign all allocation
yes. malloc is obligated to do that.
if the struct alignment was not 8bytes, ldd would not be used.
= 8 bytes to 8 byte boundary. Then what prevents compiler to
generate a ldd for the copy of a struct member at the start of a
large struct (>=8byte) that does not contain a 8 byte member?
i.e. In the test programm if st1 contains 2 longs instead of a long long
compiler would generate ld instead.
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
email@example.com :: http://www.planetfall.pwp.blueyonder.co.uk