This is the mail archive of the gcc-bugs@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: 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);
}


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