gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-vla.c
Cesar Philippidis 7ba8651ed2 re PR c++/80029 (valgrind error in new_omp_context(omp_region_type) (gimplify.c:400))
PR c++/80029

	gcc/
	* gimplify.c (is_oacc_declared): New function.
	(oacc_default_clause): Use it to set default flags for acc declared
	variables inside parallel regions.
	(gimplify_scan_omp_clauses): Strip firstprivate pointers for acc
	declared variables.
	(gimplify_oacc_declare): Gimplify the declare clauses.  Add the
	declare attribute to any decl as necessary.

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/declare-vla.c: New test.

From-SVN: r246381
2017-03-22 06:52:10 -07:00

26 lines
345 B
C

/* Verify that acc declare accept VLA variables. */
#include <assert.h>
int
main ()
{
int N = 1000;
int i, A[N];
#pragma acc declare copy(A)
for (i = 0; i < N; i++)
A[i] = -i;
#pragma acc kernels
for (i = 0; i < N; i++)
A[i] = i;
#pragma acc update host(A)
for (i = 0; i < N; i++)
assert (A[i] == i);
return 0;
}