aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/metadirective-condition.c
blob: 099ad9d2cc1f467fb5455e7f8391e1b9d2d76bcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* { dg-do compile } */
/* { dg-additional-options "-fdump-tree-original" } */

static int arr[10];
static int g (int a) { return -a; }

void f (int *ptr, float x) {

  /* Implicit conversion float -> bool */
  #pragma omp metadirective when(user={condition(x)} : nothing) otherwise(nothing)

  /* Implicit conversion pointer -> bool */
  #pragma omp metadirective when(user={condition(ptr)} : nothing) otherwise(nothing)

  /* Array expression undergoes array->pointer conversion, OK but test is
     always optimized away.  */
  #pragma omp metadirective when(user={condition(arr)} : nothing) otherwise(nothing)

  /* Function reference has pointer-to-function type, OK but test is
     always optimized away.  */
  #pragma omp metadirective when(user={condition(g)} : nothing) otherwise(nothing)
}

/* { dg-final { scan-tree-dump "x != 0.0" "original" } } */
/* { dg-final { scan-tree-dump "ptr != 0B" "original" } } */