Richard Biener wrote: > On Mon, Jul 14, 2014 at 8:55 PM, Ulrich Weigand <uweig...@de.ibm.com> wrote: > > Hello, > > > > this is an attempt to update the prior patch: > > https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00635.html > > to add a -Wpsabi note as discussed. > > > > However, this is causing a bit of difficulties. First of all, the warning > > triggers in a larger number of tests -- which was probably to be expected > > since a number of tests in the suite explicitly work on GCC vectors defined > > using various vector_size values, and any size except 16 will result in the > > warning. Note that the warning gets issued at the site of definition of > > the structure type -- it does not have to be used in a function call. > > > > More problematic is that this new warning causes four tests to fail > > (it's actually 38 new FAILS since each of the tests fails in multiple > > optimization levels): > > > > FAIL: gcc.c-torture/execute/20050316-1.c compilation > > gcc.c-torture/execute/20050316-1.c:53:9: note: the layout of aggregates > > containing vectors with 8-byte alignment has changed in GCC 4.10 > > FAIL: gcc.c-torture/execute/20050316-3.c compilation > > gcc.c-torture/execute/20050316-3.c:26:9: note: the layout of aggregates > > containing vectors with 8-byte alignment has changed in GCC 4.10 > > FAIL: gcc.c-torture/execute/20050604-1.c compilation > > gcc.c-torture/execute/20050604-1.c:12:1: note: the layout of aggregates > > containing vectors with 8-byte alignment has changed in GCC 4.10 > > FAIL: gcc.c-torture/execute/pr23135.c compilation > > gcc.c-torture/execute/pr23135.c:20:1: note: the layout of aggregates > > containing vectors with 8-byte alignment has changed in GCC 4.10 > > > > Unfortunately, while most of the tests in the suite use the dg-test > > framework which ignores "note" messages, the gcc.c-torture/execute > > tests still use the old "torture" test framework, which does *not*. > > (Also, in the old framework you cannot even add dg-... commands to > > ignore those messages for a certain test, or add a -Wno-psabi option.) > > > > Therefore, I'm not proposing to commit this patch as-is, but would > > like to ask for feedback on how to best proceed with this. > > > > One option might be to move the affected tests to the dg-test framework. > > Or else we might decide we don't actually need a warning for this change, > > since it only affects GCC synthetic vectors, where we might not have made > > strict ABI guarantees anyway ... > > > > Thoughts? > > cat gcc/testsuite/gcc.c-torture/execute/pr38151.x > set additional_flags "-Wno-psabi" > return 0
Ah, I had forgotten about the .x files. Thanks! Here's a version with the -Wno-psabi added to the .x files. This now passes regression testing. OK for mainline? Bye, Ulrich gcc/ChangeLog: * config/rs6000/rs6000-protos.h (rs6000_special_adjust_field_align_p): Add prototype. * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): New function. * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Call it. * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise. * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Likewise. gcc/testsuite/ChangeLog: * gcc.target/powerpc/ppc64-abi-warn-3.c: New test. * gcc.c-torture/execute/20050316-1.x: Add -Wno-psabi. * gcc.c-torture/execute/20050604-1.x: Add -Wno-psabi. * gcc.c-torture/execute/20050316-3.x: New file. Add -Wno-psabi. * gcc.c-torture/execute/pr23135.x: Likewise. Index: gcc/config/rs6000/rs6000-protos.h =================================================================== --- gcc/config/rs6000/rs6000-protos.h (revision 212147) +++ gcc/config/rs6000/rs6000-protos.h (working copy) @@ -155,6 +155,7 @@ #ifdef TREE_CODE extern unsigned int rs6000_data_alignment (tree, unsigned int, enum data_align); +extern bool rs6000_special_adjust_field_align_p (tree, unsigned int); extern unsigned int rs6000_special_round_type_align (tree, unsigned int, unsigned int); extern unsigned int darwin_rs6000_special_round_type_align (tree, unsigned int, Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 212147) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -5878,6 +5878,32 @@ return align; } +/* Previous GCC releases forced all vector types to have 16-byte alignment. */ + +bool +rs6000_special_adjust_field_align_p (tree field, unsigned int computed) +{ + if (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (field)) == VECTOR_TYPE) + { + if (computed != 128) + { + static bool warned; + if (!warned && warn_psabi) + { + warned = true; + inform (input_location, + "the layout of aggregates containing vectors with" + " %d-byte alignment has changed in GCC 4.10", + computed / BITS_PER_UNIT); + } + } + /* In current GCC there is no special case. */ + return false; + } + + return false; +} + /* AIX increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. */ Index: gcc/config/rs6000/sysv4.h =================================================================== --- gcc/config/rs6000/sysv4.h (revision 212147) +++ gcc/config/rs6000/sysv4.h (working copy) @@ -292,7 +292,7 @@ /* An expression for the alignment of a structure field FIELD if the alignment computed in the usual way is COMPUTED. */ #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ - ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ + (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ ? 128 : COMPUTED) #undef BIGGEST_FIELD_ALIGNMENT Index: gcc/config/rs6000/linux64.h =================================================================== --- gcc/config/rs6000/linux64.h (revision 212147) +++ gcc/config/rs6000/linux64.h (working copy) @@ -246,7 +246,7 @@ /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ - ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ + (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ ? 128 \ : (TARGET_64BIT \ && TARGET_ALIGN_NATURAL == 0 \ Index: gcc/config/rs6000/freebsd64.h =================================================================== --- gcc/config/rs6000/freebsd64.h (revision 212147) +++ gcc/config/rs6000/freebsd64.h (working copy) @@ -367,7 +367,7 @@ /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ - ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ + (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ ? 128 \ : (TARGET_64BIT \ && TARGET_ALIGN_NATURAL == 0 \ Index: gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c =================================================================== --- /dev/null +++ gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c (revision 0) @@ -0,0 +1,9 @@ +/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec" } */ + +struct test + { + int a __attribute__((vector_size (8))); + }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment has changed" } */ + Index: gcc/testsuite/gcc.c-torture/execute/pr23135.x =================================================================== --- /dev/null +++ gcc/testsuite/gcc.c-torture/execute/pr23135.x (revision 0) @@ -0,0 +1,2 @@ +set additional_flags "-Wno-psabi" +return 0 Index: gcc/testsuite/gcc.c-torture/execute/20050316-1.x =================================================================== --- gcc/testsuite/gcc.c-torture/execute/20050316-1.x (revision 212147) +++ gcc/testsuite/gcc.c-torture/execute/20050316-1.x (working copy) @@ -4,4 +4,5 @@ return 1 } +set additional_flags "-Wno-psabi" return 0; Index: gcc/testsuite/gcc.c-torture/execute/20050316-3.x =================================================================== --- /dev/null +++ gcc/testsuite/gcc.c-torture/execute/20050316-3.x (revision 0) @@ -0,0 +1,2 @@ +set additional_flags "-Wno-psabi" +return 0 Index: gcc/testsuite/gcc.c-torture/execute/20050604-1.x =================================================================== --- gcc/testsuite/gcc.c-torture/execute/20050604-1.x (revision 212147) +++ gcc/testsuite/gcc.c-torture/execute/20050604-1.x (working copy) @@ -6,4 +6,5 @@ set additional_flags "-mno-mmx" } +set additional_flags "-Wno-psabi" return 0 -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain ulrich.weig...@de.ibm.com