From: David Malcolm Date: Thu, 7 Jan 2021 02:42:56 +0000 (-0500) Subject: analyzer: fix missing bitmap_clear [PR98564] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cffe6dd2ce358c2cb550c9fb3c57cec65eee1c93;p=gcc.git analyzer: fix missing bitmap_clear [PR98564] gcc/analyzer/ChangeLog: PR analyzer/98564 * engine.cc (exploded_path::feasible_p): Add missing call to bitmap_clear. gcc/testsuite/ChangeLog: PR analyzer/98564 * gcc.dg/analyzer/pr98564.c: New test. --- diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index 3ea4524bd65..8bc9adf5ee6 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -3374,6 +3374,7 @@ exploded_path::feasible_p (logger *logger, feasibility_problem **out, LOG_SCOPE (logger); auto_sbitmap snodes_visited (eg->get_supergraph ().m_nodes.length ()); + bitmap_clear (snodes_visited); /* Traverse the path, updating this model. */ region_model model (eng->get_model_manager ()); diff --git a/gcc/testsuite/gcc.dg/analyzer/pr98564.c b/gcc/testsuite/gcc.dg/analyzer/pr98564.c new file mode 100644 index 00000000000..74b1abec6bf --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr98564.c @@ -0,0 +1,6 @@ +void *calloc (__SIZE_TYPE__, __SIZE_TYPE__); + +void test_1 (void) +{ + int *p = calloc (0, 1); /* { dg-message "allocated here" } */ +} /* { dg-warning "leak of 'p'" } */