0
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3
|
|
4 int main ()
|
|
5 {
|
|
6 volatile int *k = (int *) malloc (sizeof (int));
|
|
7 volatile int l;
|
|
8 if (k == NULL) abort ();
|
|
9 *k = 5;
|
|
10 free ((void *) k);
|
|
11 __mf_set_options ("-ignore-reads");
|
|
12 l = *k; /* Should not trip, even though memory region just freed. */
|
|
13 __mf_set_options ("-no-ignore-reads");
|
|
14 l = *k; /* Should trip now. */
|
|
15 return 0;
|
|
16 }
|
|
17 /* { dg-output "mudflap violation 1.*check/read.*" } */
|
|
18 /* { dg-output "Nearby object 1.*" } */
|
|
19 /* { dg-output "mudflap dead object.*malloc region.*" } */
|
|
20 /* { dg-do run { xfail *-*-* } } */
|