aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/pr106981.c
blob: ed48d2774f2a5945cf97f94a1dc0e0695b4e6d67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* PR c/106981 */

int
main ()
{
  int a[0x101];
  unsigned int b = 0x100;
  if ((unsigned char) b || (unsigned short) b != 0x100)
    return 0;
  a[0] = 0;
  a[0x100] = 42;
  #pragma omp atomic update
  a[(unsigned char) b] = a[(unsigned short) b] + a[(unsigned char) b];
  #pragma omp atomic update
  a[(unsigned char) b] = a[(unsigned char) b] + a[(unsigned short) b];
  if (a[0] != 84 || a[0x100] != 42)
    __builtin_abort ();
  return 0;
}