diff mbox

PR68972: g++.dg/cpp1y/vla-initlist1.C test case fails on power

Message ID 1f75646f-4e48-17de-e081-0f2f031750b7@linux.vnet.ibm.com
State New
Headers show

Commit Message

Kelvin Nilsen Feb. 6, 2017, 10:20 p.m. UTC
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  <kelvin@gcc.gnu.org>

	PR target/68972
	* g++.dg/cpp1y/vla-initlist1.C: Add dg-skip-if directive to
	disable this test on power architecture.

 #include <initializer_list>

Comments

Rainer Orth Feb. 6, 2017, 11:12 p.m. UTC | #1
Kelvin Nilsen <kdnilsen@linux.vnet.ibm.com> writes:

> 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*-*-*"
> } { "*" } { "" } }

Please omit the default args to dg-skip-if: they're unnecessary.

	Rainer
Kelvin Nilsen June 26, 2017, 10:22 p.m. UTC | #2
Is this ok for backport to GCC 6?

On 02/06/2017 03:20 PM, Kelvin Nilsen wrote:
> 
> 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  <kelvin@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>
> 
>
diff mbox

Patch

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" }