On 12/14/2016 09:21 PM, Martin Sebor wrote:
I suppose setting a range seemed better than giving up. Then again,
since with this patch GCC will warn on null %s pointers there may
not be much point in trying to see if there's also some other
problem after that, except perhaps in code that deliberately relies
on the Glibc feature. I'd be fine with just stopping at this point
if you prefer.
I think I'd rather just stop at this point. I don't think we're gaining
much, if anything and encoding the glibc-ism in here seems like a
mistake.
That's fine. Attached is an updated patch with this change.
Thanks
Martin
gcc-78519.diff
PR middle-end/78519 - missing warning for sprintf %s with null pointer
gcc/ChangeLog:
PR middle-end/78519
* gimple-ssa-sprintf.c (format_string): Handle null pointers.
(format_directive): Diagnose null pointer arguments.
(pass_sprintf_length::handle_gimple_call): Diagnose null destination
pointers. Correct location of null format string in diagnostics.
gcc/testsuite/ChangeLog:
PR middle-end/78519
* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: New test.
So I think we should defer this given the vigorous discussion around the
other NULL checks. This has the same issues that we're discussing in
the other, rather heated, thread.
Jeff