
It's an orthogonal concern why these diagnostics do appear at all for
non-offloaded OpenACC constructs (where they're not relevant at all); PR90115.
Depending on how 'assert' is implemented, it may cause temporaries to be
created, and/or may lower into 'COND_EXPR's, and
'gcc/gimplify.cc:gimplify_cond_expr' uses 'create_tmp_var (type, "iftmp")'.
Fix-up for commit 11b8286a83
"[OpenACC privatization] Largely extend diagnostics and
corresponding testsuite coverage [PR90115]".
PR testsuite/102841
libgomp/
* testsuite/libgomp.oacc-c-c++-common/host_data-7.c: Adjust.
78 lines
2.8 KiB
C
78 lines
2.8 KiB
C
/* Test if, if_present clauses on host_data construct. */
|
|
|
|
/* { dg-additional-options "-fopt-info-all-omp" }
|
|
{ dg-additional-options "--param=openacc-privatization=noisy" }
|
|
{ dg-additional-options "-foffload=-fopt-info-all-omp" }
|
|
{ dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
|
|
Prune a few: uninteresting, and potentially varying depending on GCC configuration (data types) or 'assert' implementation:
|
|
{ dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} }
|
|
{ dg-prune-output {note: variable 'iftmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} } */
|
|
|
|
/* C/C++ variant of 'libgomp.oacc-fortran/host_data-5.F90' */
|
|
|
|
#include <assert.h>
|
|
#include <stdint.h>
|
|
|
|
void
|
|
foo (float *p, intptr_t host_p, int cond)
|
|
{
|
|
assert (p == (float *) host_p);
|
|
|
|
#pragma acc data copyin(host_p)
|
|
{
|
|
#pragma acc host_data use_device(p) if_present
|
|
/* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
|
|
/* p not mapped yet, so it will be equal to the host pointer. */
|
|
assert (p == (float *) host_p);
|
|
|
|
#pragma acc data copy(p[0:100])
|
|
/* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
|
|
{
|
|
/* Not inside a host_data construct, so p is still the host pointer. */
|
|
assert (p == (float *) host_p);
|
|
|
|
#pragma acc host_data use_device(p)
|
|
/* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
|
|
{
|
|
#if ACC_MEM_SHARED
|
|
assert (p == (float *) host_p);
|
|
#else
|
|
/* The device address is different from host address. */
|
|
assert (p != (float *) host_p);
|
|
#endif
|
|
}
|
|
|
|
#pragma acc host_data use_device(p) if_present
|
|
/* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
|
|
{
|
|
#if ACC_MEM_SHARED
|
|
assert (p == (float *) host_p);
|
|
#else
|
|
/* p is present now, so this is the same as above. */
|
|
assert (p != (float *) host_p);
|
|
#endif
|
|
}
|
|
|
|
#pragma acc host_data use_device(p) if(cond)
|
|
/* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
|
|
{
|
|
#if ACC_MEM_SHARED
|
|
assert (p == (float *) host_p);
|
|
#else
|
|
/* p is the device pointer iff cond is true. */
|
|
assert ((p != (float *) host_p) == cond);
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
float arr[100];
|
|
foo (arr, (intptr_t) arr, 0);
|
|
foo (arr, (intptr_t) arr, 1);
|
|
|
|
return 0;
|
|
}
|