summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/mpx/chkp-fix-calls-3.c
blob: 439f631a3b932d70618cc67f4a1752e9f4b27878 (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
32
33
/* { dg-do compile } */
/* { dg-options "-O2 -fexceptions -fcheck-pointer-bounds -mmpx" } */

extern int f2 (const char*, int, ...);
extern long int f3 (int *);
extern void err (void) __attribute__((__error__("error")));

extern __inline __attribute__ ((__always_inline__)) int
f1 (int i, ...)
{
  if (__builtin_constant_p (i))
    {
      if (i)
	err ();
      return f2 ("", i);
    }

  return f2 ("", i);
}

int
test ()
{
  int i;

  if (f1 (0))
    if (f3 (&i))
      i = 0;

  return i;
}