[llvm-commits] [llvm-gcc-4.2] r63288 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Fri Jan 30 04:32:57 PST 2009


Hi Chris,

> If a FIELD_DECL says its alignment is 16 bytes, and the base pointer
> is only known to be 8-byte aligned, round up to 16 bytes.  I believe 
> that this is always safe.  Duncan, I would appreciate the review.

how can this possibly be safe?  My understanding is that the alignment
of a FIELD_DECL gives it's alignment within the surrounding struct.
It does not force anything on how objects of the struct type are aligned.
If an object of that struct type has alignment 1 (examples of this are
easy to create) then in general the field will also have alignment 1
no matter what the field alignment says.  For example, if the numerical
value of the pointer is 7 then the first field will have alignment 1
no matter what the alignment of it's FIELD_DECL says.  I could be wrong
of course (I often am!) but I don't think so :)

Ciao,

Duncan.



More information about the llvm-commits mailing list