https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236
--- Comment #16 from Mukund Sivaraman <muks at banu dot com> --- (In reply to Andrew Pinski from comment #15) > > At the very least, if it is possible to detect that the pointer is NULL by > > static analysis and it is being passed to a function that has the notnull > > attribute, please warn mentioning inferences being made. > The warning did not make it into gcc 4.9 due to the patches to do the > warning were not ready. Gcc 4.10 should warn about it. If it does not then > that is a bug. Thank you for this. :) It should detect at least some cases in that case. If qsort() can cause this sort of disruption to a caller if NULL is passed, I guess a change in glibc to add an assert(base != NULL) or similar abort is also in order given that the caller code becomes buggy otherwise. Do you agree? This would catch remaining cases before any inferred decisions are executed after the qsort().