For avr we have multiple failures of testcases due to alignment warnings such as:
gcc/gcc/testsuite/gcc.dg/debug/const-1.c:3: warning: alignment of 'Foo' is greater than maximum object file alignment. Using 1 Which in this example occurs due to: typedef float FloatVect __attribute__((__vector_size__(16))); FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 }; While trying to fix this I have discovered several issues which make the "correct" fix somewhat unclear and perhaps indicating more than one bug. The warning occurs because alignment of the vector is 16 bytes regardless of all target alignment controls. In particular: #define BIGGEST_ALIGNMENT 8 By default this also determines MAX_OFILE_ALIGNMENT which is used by the alignment check in varasm.c (if (16>1) Warning) Problem 1) varasm.c - is the only place MAX_OFILE_ALIGNMENT is used. Here it immediately tries to increase or decrease alignment AFTER it does check - which suggests the check is misplaced or not useful in the first place. To get around the test failure target MAX_OFILE_ALIGNMENT can be increased. (and logically should be to permit user defined alignments) Problem 2) Without hard limit imposed by MAX_OFILE_ALIGNMENT vectors are aligned at 16 bytes - which break the supposed limit of BIGGEST_ALIGNMENT (1 byte). Vector size is set in stor-layout.c : /* Always naturally align vectors. This prevents ABI changes depending on whether or not native vector modes are supported. */ TYPE_ALIGN (type) = tree_low_cst (TYPE_SIZE (type), 0); break; There is no way for target to override this alignment. It does not seem correct to assume a specific vector alignment independent of target. Perhaps there should be: #ifdef TARGET_VECTOR_ALIGN (..) ... ... #else Some may say that vectors are relevant only targets that support hardware vector operations and thus alignment choice is currently moot. But.. Problem 3) gcc provide no hooks for the target or testsuite to elegantly disable vector extensions (that I can find anyway). -- Summary: Vector alignment overides Target alignment Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hutchinsonandy at gcc dot gnu dot org GCC host triplet: i686-pc-linux-gnu GCC target triplet: avr-unknown-none http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36212