summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/mpx/if-stmt-1-ubv.c
blob: 021a3aed2678683cfab3a9518385e10ffa3c1b93 (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
26
27
28
29
30
/* { dg-do run } */
/* { dg-shouldfail "bounds violation" } */
/* { dg-options "-fcheck-pointer-bounds -mmpx" } */


#define SHOULDFAIL

#include "mpx-check.h"

int rd (int *p1, int *p2, int i)
{
  int res;

  if (p1 < p2)
    p1 = p2;

  res = p1[i];
  printf ("%d\n", res);
  return res;
}

int buf[100];

int mpx_test (int argc, const char **argv)
{
  int *p = __bnd_set_ptr_bounds (buf + 1, 40);
  rd (buf, p, 10);

  return 0;
}