This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: IA64 record alignment rules, and modes?
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: "Gary Funck" <gary at intrepid dot com>
- Cc: "GCC List" <gcc at gcc dot gnu dot org>
- Date: Sun, 27 Feb 2005 13:28:36 +0000
- Subject: Re: IA64 record alignment rules, and modes?
- References: <JCEPIPKHCJGDMPOHDOIGMEILCNAA.gary@intrepid.com>
"Gary Funck" <gary@intrepid.com> writes:
> typedef struct sptr_struct
> {
> long unsigned int phase: 48;
> short unsigned int thread: 16;
> void *addr;
> } sptr_t;
>
> is assigned a BLKmode rather a TImode, [...]
>
> Question: If we assume that a TImode would've been a more efficient mode
> to represent the record type above, would it not have been acceptable for
> the compiler to promote the alignment of this type to 128, given there
> are no apparent restrictions otherwise, or are there other C conventions
> at work that dictate otherwise?
Well, if you had:
struct foo {
sptr_struct s;
void *p;
} foo_struct;
then sizeof (foo_struct) should be 16 + 8 == 24. If gcc bumped the
alignment of sptr_struct to 128 bits, it would also have to bump the
size of foo_struct to 32 bytes in order to maintain current alignment.
If it didn't, a declaration like:
struct foo x[2];
would lead to x[1].s not being correctly aligned.
Richard