1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ #include <stdlib.h> void test_1 (int x, int y, int *out) { int *ptr = (int *)malloc (sizeof (int)); if (!ptr) return; *ptr = 19; free (ptr); *out = *ptr; /* { dg-warning "use after 'free' of 'ptr'" } */ }