mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-10 08:22:11 +01:00
30 lines
416 B
C
30 lines
416 B
C
/*
|
|
* @@name: atomic_restrict.2
|
|
* @@type: C
|
|
* @@operation: compile
|
|
* @@expect: unspecified
|
|
* @@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 */
|
|
|
|
}
|
|
}
|