On 01/22/2017 04:53 PM, Martin Sebor wrote:
This is the last patch in the series. It adds logic to handle
non-constant width and precision with range information to help
reduce both false positives false negatives. The patch replaces
the scalar width and precision with two element arrays throughout
the pass and makes adjustments to reflect their bounds in the byte
counters. Since the basic infrastructure for this is present in
the code the changes are fairly mechanical.
gcc-78703-5.diff
commit c0a1f67fedb531abaf4760e8cd5b9b037ef5d4c4
Author: Martin Sebor <mse...@redhat.com>
Date: Sun Jan 22 12:37:33 2017 -0700
2017-01-22 Martin Sebor <mse...@redhat.com>
* gimple-ssa-sprintf.c (adjust_for_width_or_precision): Change
to accept adjustment as an array.
(get_int_range): New function.
(struct directive): Make width and prec arrays.
(directive::set_width, directive::set_precision): Call get_int_range.
(format_integer, format_floating): Handle width and precision ranges.
(format_string, parse_directive): Same.
gcc/testsuite:
* gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: Update
* gcc.dg/tree-ssa/builtin-sprintf-warn-9.c: Rename...
* gcc.dg/tree-ssa/builtin-sprintf-warn-10.c: ...to this.
* gcc.dg/tree-ssa/builtin-sprintf-warn-9.c: New test.
I'm still working on #4, which is still fairly large. I needed to step
away from it for a bit.
Regardless #5 is OK.
Jeff