On Mon, Dec 19, 2016 at 01:24:34PM -0700, Jeff Law wrote:
> > 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.

If this would be only warned if !fold_return_value, then it wouldn't be
having the same issues.  Though of course, it would diagnose fewer cases.
Conceptually it isn't much dependent on the gimple-ssa-sprintf.c stuff,
so could be warned without too much effort from other pass, perhaps
by using a few helpers from gimple-ssa-sprintf.c.

        Jakub

Reply via email to