1 /* { dg-additional-options "-O3 -fsanitize=undefined" } */
2 
3 void memory_exhausted();
memcheck(void * ptr)4 void memcheck(void *ptr) {
5   if (ptr) /* { dg-warning "leak" } */
6     memory_exhausted();
7 }
8 
emalloc(int size)9 int emalloc(int size) { memcheck(__builtin_malloc(size)); } /* { dg-message "allocated here" } */
main()10 int main() { int max_envvar_len = emalloc(max_envvar_len + 1); } /* { dg-message "use of uninitialized value 'max_envvar_len'" } */
11