view gcc/testsuite/c-c++-common/gomp/atomic-15.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-options "-fopenmp" } */

int x = 6;

int
main ()
{
  int v;
  #pragma omp atomic
    x = x * 7 + 6;	/* { dg-error "expected|invalid form of" } */
  #pragma omp atomic
    x = x * 7 ^ 6;	/* { dg-error "expected|invalid form of" } */
  #pragma omp atomic update
    x = x - 8 + 6;	/* { dg-error "expected|invalid form of" } */
  #pragma omp atomic
    x = x ^ 7 | 2;	/* { dg-error "expected|invalid form of" } */
  #pragma omp atomic
    x = x / 7 * 2;	/* { dg-error "expected|invalid form of" } */
  #pragma omp atomic
    x = x / 7 / 2;	/* { dg-error "expected|invalid form of" } */
  #pragma omp atomic capture
    { v = x; x = x * 7 + 6; }	/* { dg-error "expected" "" { target c++ } } */
  #pragma omp atomic capture
    { v = x; x = x * 7 ^ 6; }	/* { dg-error "expected" "" { target c++ } } */
  #pragma omp atomic capture
    { v = x; x = x - 8 + 6; }	/* { dg-error "expected" "" { target c++ } } */
  #pragma omp atomic capture
    { v = x; x = x ^ 7 | 2; }	/* { dg-error "expected" "" { target c++ } } */
  #pragma omp atomic capture
    { v = x; x = x / 7 * 2; }	/* { dg-error "expected" "" { target c++ } } */
  #pragma omp atomic capture
    { v = x; x = x / 7 / 2; }	/* { dg-error "expected" "" { target c++ } } */
  #pragma omp atomic capture
    { x = x * 7 + 6; v = x; }	/* { dg-error "expected|uses two different expressions for memory" } */
  #pragma omp atomic capture
    { x = x * 7 ^ 6; v = x; }	/* { dg-error "expected|uses two different expressions for memory" } */
  #pragma omp atomic capture
    { x = x - 8 + 6; v = x; }	/* { dg-error "expected|uses two different expressions for memory" } */
  #pragma omp atomic capture
    { x = x ^ 7 | 2; v = x; }	/* { dg-error "expected|uses two different expressions for memory" } */
  (void) v;
  return 0;
}