This is the mail archive of the gcc-help@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: structure packing


Mohamed Shafi <shafitvm@gmail.com> writes:

>     I thought so. With STRICT_ALIGNMENT = 1 the compiler makes sure
> that all access are aligned. So irrespective of whether the structure
> is aligned or not to be safe it generates byte access. Am i right?
> If so in the given example the base address is 0 and the offset will
> be known to the compiler. If the compiler is aware of these two
> information can't it decide whether the structure is aligned or not?

I'm not sure.  If the compiler knows the alignment of the specific
object, it may take that into account to override the packed attribute.
However, I would not be surprised if a specific case like casting 0 to
an address does not record the alignment even though it is known, since
that is such an odd case.

Ian


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