summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/mpx/bitfields-1-nov.c
blob: 0a7913a256d16a78cae486ca1280483eeb5c8523 (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-options "-fcheck-pointer-bounds -mmpx" } */


#include "mpx-check.h"

struct s {
  int a;
  int b : 10;
  int c : 1;
  int e : 10;
} s;

#define HH (unsigned char)1

int foo (struct s *p)
{
  int val = p->b;
  printf ("%d\n", val);
  return val == HH;
}

int mpx_test (int argc, const char **argv)
{
  struct s buf[100];

  foo (buf);
  foo (buf + 99);

  return 0;
}