1 /* { dg-require-effective-target sigsetjmp } */ 2 3 #include <setjmp.h> 4 #include <stddef.h> 5 #include <stdlib.h> 6 7 extern int foo (int) __attribute__ ((__pure__)); 8 9 static jmp_buf env; 10 inner(void)11static void inner (void) 12 { 13 void *ptr = malloc (1024); /* { dg-message "allocated here" } */ 14 15 siglongjmp (env, 1); /* { dg-warning "leak of 'ptr'" "warning" } */ 16 /* { dg-message "rewinding from 'siglongjmp' in 'inner'" " event: rewind from" { target *-*-* } .-1 } */ 17 18 free (ptr); 19 } 20 outer(void)21void outer (void) 22 { 23 int i; 24 25 foo (0); 26 27 i = sigsetjmp(env, 0); /* { dg-message "'sigsetjmp' called here" "event: sigsetjmp call" } */ 28 /* { dg-message "to 'sigsetjmp' in 'outer'" "event: rewind to" { target *-*-* } .-1 } */ 29 30 if (i == 0) 31 { 32 foo (1); 33 inner (); 34 } 35 36 foo (3); 37 } 38