aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/spec-barrier-2.c
blob: a27ec54f0d3822f503103f2b475c6978b70aac76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* { dg-do run } */
/* { dg-additional-options "-Wno-volatile" { target c++ } } */

/* Even on targets that don't need the optional failval parameter,
   side-effects on the operand should still be calculated.  */

int x = 3;
volatile int y = 9;

int main ()
{
  int z = __builtin_speculation_safe_value (x, y++);
  if (z != 3 || y != 10)
    __builtin_abort ();
  return 0;
}

/* { dg-prune-output "this target does not define a speculation barrier;" } */