summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/mpx/static-init-6-nov.c
blob: a125024ecc344e33fead0692cc954d88eeb36c5d (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
/* { dg-do run } */
/* { dg-options "-fcheck-pointer-bounds -mmpx" } */


#include "mpx-check.h"

int buf1[100];
int buf2[200];

struct s1 {
  int a;
  int *p[2];
} s1;

struct s2 {
  int a;
  struct s1 b[2];
} s2;

int mpx_test (int argc, const char **argv)
{
  struct s2 s = { 1, { {1, { buf1, buf2 }}, {2, { buf2, buf1} } } };

  printf ("%d\n", s.b[0].p[0][0]);
  printf ("%d\n", s.b[0].p[0][99]);

  return 0;
}