The test g++.dg/cpp1y/vla-initlist1.C makes assumptions that the memory used to represent the private temporary variables of neighboring control blocks at the same control nesting level is:
1. found at the same address, and 2. not overwritten between when the first block ends and the second block begins. While these assumptions are valid with some optimization choices on some architectures, these assumptions do not hold universally. With optimization disabled on the power architecture, the g++.dg/cpp1y/vla-initlist1.C test program runs initialization code to allocate the variable-length array a[] before entry into the second of two neighboring control blocks. This initialization code overwrites the first two cells of the array i[] that were initialized by the first of the two neighboring control blocks. Thus, the initialization value stored into i[1] is no longer present when this value is subsequently fetched as a[1].i from within the second control block. This patch disables this particular test case on power hardware. The patch has been bootstrapped and tested on powerpc64le-unknown-linux with no regressions. Is this ok for trunk? gcc/testsuite/ChangeLog: 2017-02-06 Kelvin Nilsen <kel...@gcc.gnu.org> PR target/68972 * g++.dg/cpp1y/vla-initlist1.C: Add dg-skip-if directive to disable this test on power architecture. Index: gcc/testsuite/g++.dg/cpp1y/vla-initlist1.C =================================================================== --- gcc/testsuite/g++.dg/cpp1y/vla-initlist1.C (revision 245156) +++ gcc/testsuite/g++.dg/cpp1y/vla-initlist1.C (working copy) @@ -1,4 +1,5 @@ // { dg-do run { target c++11 } } +// { dg-skip-if "power overwrites two slots of array i" { "power*-*-*" } { "*" } { "" } } // { dg-options "-Wno-vla" } #include <initializer_list>