https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236

--- Comment #12 from Andrew Pinski <pinskia 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.

7.1.4 says this:
Each of the following statements applies unless explicitly stated otherwise in
the detailed
descriptions that follow: If an argument to a function has an invalid value
(such as a value
outside the domain of the function, or a pointer outside the address space of
the program,
or a null pointer, or a pointer to non-modifiable storage when the corresponding
parameter is not const-qualified) or a type (after promotion) not expected by a
function
with variable number of arguments, the behavior is undefined.

So there is not need to say it was detected to be non-null as the null pointer
case is mentioned in 7.1.4.

Reply via email to