This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Alignment of unions containing vector types
- From: David Robinson <drtr at enjura dot com>
- To: Tim Prince <tprince at computer dot org>
- Cc: bug-gcc at gcc dot gnu dot org
- Date: Mon, 27 May 2002 02:58:33 -0700 (PDT)
- Subject: Re: Alignment of unions containing vector types
On Sat, 25 May 2002, Tim Prince wrote:
> AFAIK, gcc is not expected to be capable of forcing alignments in main(). I
> think the documentation on this might be improved. I don't know whether it
> is considered a bug if the option -mpreferred-stack-boundary=4 has to be
> issued specifically in order for called functions to observe alignments.
Tim,
I don't think that's the issue; it's not the alignment of the stack
variable but the alignment requirement of the union type that is the
problem.
David
% gcc31 -O2 -Wall -o try try.c -mmmx
% ./try
alignof(v2si_u): 4
try.c:
#include <stdio.h>
#include <stdlib.h>
typedef int _v2si __attribute__ ((mode(V2SI)));
typedef union
{
_v2si v;
int i[2];
} v2si_u;
int main(int argc, char **argv)
{
printf("alignof(v2si_u): %d\n", __alignof__(v2si_u));
exit(0);
}