b1c9c068f7
gcc/c/ * c-parser.c (c_parser_oacc_declare): Don't scan for GOMP_MAP_POINTER. * c-typeck.c (handle_omp_array_sections): Mark data clauses with GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having zero-length subarrays. gcc/cp/ * parser.c (cp_parser_oacc_declare): Don't scan for GOMP_MAP_POINTER. * semantics.c (handle_omp_array_sections): Mark data clauses with GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having zero-length subarrays. gcc/ * omp-low.c (lower_omp_target): Mark data clauses with GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having zero-length subarrays. libgomp/ * testsuite/libgomp.oacc-c-c++-common/zero_length_subarrays.c: New test. From-SVN: r238376
46 lines
563 B
C
46 lines
563 B
C
/* Exercise zero-length sub-arrays. */
|
|
|
|
const int n = 10;
|
|
|
|
void
|
|
subzero_present (int *a, int n)
|
|
{
|
|
#pragma acc data present (a[0:n])
|
|
;
|
|
#pragma acc data pcopy (a[0:n])
|
|
;
|
|
#pragma acc data pcopyin (a[0:n])
|
|
;
|
|
#pragma acc data pcopyout (a[0:n])
|
|
;
|
|
|
|
}
|
|
|
|
void
|
|
subzero (int *a, int n)
|
|
{
|
|
#pragma acc data create (a[0:n])
|
|
;
|
|
#pragma acc data copy (a[0:n])
|
|
;
|
|
#pragma acc data copyin (a[0:n])
|
|
;
|
|
#pragma acc data copyout (a[0:n])
|
|
;
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
int a[n];
|
|
|
|
#pragma acc data copy (a[0:n])
|
|
{
|
|
subzero_present (a, 0);
|
|
}
|
|
|
|
subzero (a, 0);
|
|
|
|
return 0;
|
|
}
|