https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236
--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #11) > It is not incorrect as the C standard says this about qsort: > nmemb can have the value zero on a call to that function; the comparison > function is not called, a search finds no matching element, and sorting > performs no rearrangement. Pointer arguments on such a call shall still have > valid values, as described in 7.1.4. > > POSIX 2008 defers to the C standard now so this is neither a glibc or a GCC > bug in the end. I've missed the "Pointer arguments on such a call shall still have valid values, as described in 7.1.4." sentence in C99 7.20.5 (was looking for that in 7.20.5.2), with that it is exactly the same thing in this regard as memcpy etc.