summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/mpx/pointer-store-1-ubv.c
blob: 4c8d45e003f242d8babff5fc125f2d8dbaf033d7 (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
31
/* { dg-do run } */
/* { dg-shouldfail "bounds violation" } */
/* { dg-options "-fcheck-pointer-bounds -mmpx" } */


#define SHOULDFAIL

#include "mpx-check.h"

int *buf1[100];
int buf2[100];

void wr (int i)
{
  buf1[i] = buf2;
}

int rd(int i, int j)
{
  int res = buf1[i][j];
  printf("%d\n", res);
  return res;
}

int mpx_test (int argc, const char **argv)
{
  wr(10);
  rd(10, 100);

  return 0;
}