OpenMP-Examples/sources/Example_atomic_restrict.2.c
2020-06-26 07:54:45 -07:00

31 lines
429 B
C

/*
* @@name: atomic_restrict.2c
* @@type: C
* @@compilable: maybe
* @@linkable: no
* @@expect: failure
* @@version: omp_3.1
*/
void atomic_wrong2 ()
{
int x;
int *i;
float *r;
i = &x;
r = (float *)&x;
#pragma omp parallel
{
#pragma omp atomic update
*i += 1;
#pragma omp atomic update
*r += 1.0;
/* Incorrect because the atomic constructs reference the same location
through incompatible types */
}
}