1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 int main () 5 { 6 volatile int *p; 7 8 __mf_set_options ("-wipe-stack -no-check-initialization"); 9 10 { 11 volatile int array [10]; 12 p = & array[0]; 13 14 array[0] = 2; 15 array[9] = 5; 16 17 /* Array[] should be wiped clean at this point. */ 18 } 19 20 __mf_set_options ("-no-wipe-stack"); 21 22 { 23 volatile int array2[10]; 24 25 /* hope that this is allocated on top of old array[] */ 26 if (p != & array2[0]) 27 exit (0); /* Test is not applicable. */ 28 29 array2[5] = 6; 30 31 /* Old values shouldn't still be around; the new one should. */ 32 if (p[0] == 2 || p[9] == 5 || p[5] != 6) 33 abort() ; 34 35 /* array2[] should not be wiped at this point! */ 36 } 37 38 { 39 volatile int array3[10]; 40 41 /* hope that this is allocated on top of old array[] and array2[]*/ 42 if (p != & array3[0]) 43 exit (0); /* Test is not applicable. */ 44 45 array3[1] = 2; 46 47 /* Check that old assignment is still around. */ 48 if (p[5] != 6 || p[1] != 2) 49 abort() ; 50 } 51 return 0; 52 } 53