summaryrefslogtreecommitdiff
path: root/gnu/gcc/libmudflap/testsuite/libmudflap.c/fail27-frag.c
blob: 7168dfc61b20db821678f2032e14c00ea0dbb092 (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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char volatile *
__attribute__((noinline))
foo (unsigned i)
{
  char volatile buffer[10];
  char volatile *k = i ? & buffer[i] : NULL; /* defeat addr-of-local-returned warning */
  return k;
}

int main ()
{
char volatile *f = foo (5);
f[0] = 'b';

return 0;
}
/* { dg-output "mudflap violation 1.*" } */
/* { dg-output "Nearby object.*" } */
/* { dg-output "mudflap object.*buffer.*alloc.*dealloc" } */
/* { dg-do run { xfail *-*-* } } */