This is the mail archive of the gcc@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: align of local char array seem not work.


Bernd Roesch wrote:
char buf[256] __attribute__((aligned(16)));
   printf("%x\n",&buf[0]);
this short test program give no error or warning and do not align as
expect.i test with several 68k amigaos compilers (3.4.0 /4.3.2/4.4.0)

Most likely gcc did align it, but one of the assembler, linker, or OS program loader did not respect the alignment. You can try looking at the .s file, the .o file, and the executable, to try to determine where the failure occurred.


There is a macro MAX_OFILE_ALIGNMENT that you can define in the target OS .h file to specify the OS limit. GCC will then warn if you try to align a variable to a value larger than this limit. See the docs and the code in varasm.c that uses it.

Jim


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