https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104069
--- Comment #17 from Martin Sebor <msebor at gcc dot gnu.org> --- Having spent some time trying to understand the function I think the following simplification should capture its intent. It compiles without warnings at all levels: void *xrealloc (void *ptr, size_t size) { void *ret = __builtin_realloc (ptr, size); if (ret) return ret; if (!size) size = 1; ret = __builtin_realloc (ptr, size); if (ret) return ret; __builtin_abort (); }