0
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3 #include <string.h>
|
|
4
|
|
5 char volatile *
|
|
6 __attribute__((noinline))
|
|
7 foo (unsigned i)
|
|
8 {
|
|
9 char volatile buffer[10];
|
|
10 char volatile *k = i ? & buffer[i] : NULL; /* defeat addr-of-local-returned warning */
|
|
11 return k;
|
|
12 }
|
|
13
|
|
14 int main ()
|
|
15 {
|
|
16 char volatile *f = foo (5);
|
|
17 f[0] = 'b';
|
|
18
|
|
19 return 0;
|
|
20 }
|
|
21 /* { dg-output "mudflap violation 1.*" } */
|
|
22 /* { dg-output "Nearby object.*" } */
|
|
23 /* { dg-output "mudflap dead object.*buffer.*alloc.*dealloc" } */
|
|
24 /* { dg-do run { xfail *-*-* } } */
|