aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2023-03-03 17:59:21 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2023-03-03 17:59:21 -0500
commit56572a08ec4a0fc1a7802d3737cd7f7cc9089c4b (patch)
treeeab4594d22b277acd4d3b265e32935ab231d9ba7 /gcc/cp
parentd3ef73867e3f70a343ad5aa4e00b270be85fa572 (diff)
downloadgcc-56572a08ec4a0fc1a7802d3737cd7f7cc9089c4b.zip
gcc-56572a08ec4a0fc1a7802d3737cd7f7cc9089c4b.tar.gz
gcc-56572a08ec4a0fc1a7802d3737cd7f7cc9089c4b.tar.bz2
analyzer: provide placeholder implementation of sprintf
Previously, the analyzer lacked a known_function implementation of sprintf, and thus would handle calls to sprintf with the "anything could happen" fallback. Whilst working on PR analyzer/107565 I noticed that this was preventing a lot of genuine memory leaks from being reported for Doom; fixing thusly. Integration testing of the effect of the patch shows a big increase in true positives due to the case mentioned in Doom, and one new false positive (in pcre2), which I'm tracking as PR analyzer/109014. Comparison: GOOD: 67 -> 123 (+56); 10.91% -> 18.33% BAD: 547 -> 548 (+1) where the affected warnings/projects are: -Wanalyzer-malloc-leak: GOOD: 0 -> 56 (+56); 0.00% -> 41.48% BAD: 79 True positives: 0 -> 56 (+56) (all in Doom) -Wanalyzer-use-of-uninitialized-value: GOOD: 0; 0.00% BAD: 80 -> 81 (+1) False positives: pcre2-10.42: 0 -> 1 (+1) gcc/analyzer/ChangeLog: * kf.cc (class kf_sprintf): New. (register_known_functions): Register it. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/doom-d_main-IdentifyVersion.c: New test. * gcc.dg/analyzer/sprintf-1.c: New test. * gcc.dg/analyzer/sprintf-concat.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/cp')
0 files changed, 0 insertions, 0 deletions