1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wuse-after-free=2" } */
3
4 unsigned long bufmax = 0;
5 unsigned long __open_catalog_bufmax;
6 void *realloc(void *, __SIZE_TYPE__);
7 void free(void *);
8
9 void __open_catalog(char *buf)
10 {
11 char *old_buf = buf;
12 buf = realloc (buf, bufmax);
13 if (__builtin_expect ((buf == ((void *)0)), 0))
14 free (old_buf); /* { dg-bogus "used after" } */
15 }