https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104069
--- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I think the new code in comment #14 is the only code which is well defined in c17 really. Before c17 (dr400), realloc for sizes of 0 the return value was unspecified which means it could return null or an allocated one. Now in c17, it is undefined.