aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2021-11-29 11:47:47 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2021-11-29 18:50:56 -0500
commit132902177138c09803d639e12b1daebf2b9edddc (patch)
tree31a44f1e3537dd31c4500efa12338b38bc98d24d /gcc/go
parentca5667e867252db3c8642ee90f55427149cd92b6 (diff)
downloadgcc-132902177138c09803d639e12b1daebf2b9edddc.zip
gcc-132902177138c09803d639e12b1daebf2b9edddc.tar.gz
gcc-132902177138c09803d639e12b1daebf2b9edddc.tar.bz2
analyzer: further false leak fixes due to overzealous state merging [PR103217]
Commit r12-5424-gf573d35147ca8433c102e1721d8c99fc432cb44b fixed a false positive from -Wanalyzer-malloc-leak due to overzealous state merging, erroneously merging two different svalues bound to a particular part of the store when one has sm-state. A further case was discovered by the reporter of PR analyzer/103217, which this patch fixes. In this variant, different states have set different fields of a struct, and on attempting to merge them, the states have a different set of binding keys, leading to one state having an svalue with sm-state, and its peer state having a NULL value for that binding key. The state merger code was erroneously treating them as mergeable to "UNKNOWN". This followup patch fixes things by rejecting such mergers if the non-NULL svalue is not mergeable with "UNKNOWN". gcc/analyzer/ChangeLog: PR analyzer/103217 * store.cc (binding_cluster::can_merge_p): For the "key is bound" vs "key is not bound" merger case, check that the bound svalue is mergeable before merging it to "unknown", rejecting the merger otherwise. gcc/testsuite/ChangeLog: PR analyzer/103217 * gcc.dg/analyzer/pr103217-2.c: New test. * gcc.dg/analyzer/pr103217-3.c: New test. * gcc.dg/analyzer/pr103217-4.c: New test. * gcc.dg/analyzer/pr103217-5.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/go')
0 files changed, 0 insertions, 0 deletions