This is the mail archive of the 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: Structure Alignment Bug in Sparc.

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.

= 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?
if the struct alignment was not 8bytes, ldd would not be used.

i.e. In the test programm if st1 contains 2 longs instead of a long long
compiler would generate ld instead.


Nathan Sidwell    ::   ::     CodeSourcery LLC
         The voices in my head said this was stupid too    ::

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