mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
24 lines
374 B
C
24 lines
374 B
C
/*
|
|
* @@name: atomic_restrict.1c
|
|
* @@type: C
|
|
* @@compilable: maybe
|
|
* @@linkable: no
|
|
* @@expect: failure
|
|
*/
|
|
void atomic_wrong ()
|
|
{
|
|
union {int n; float x;} u;
|
|
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp atomic update
|
|
u.n++;
|
|
|
|
#pragma omp atomic update
|
|
u.x += 1.0;
|
|
|
|
/* Incorrect because the atomic constructs reference the same location
|
|
through incompatible types */
|
|
}
|
|
}
|