From cffe6dd2ce358c2cb550c9fb3c57cec65eee1c93 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 6 Jan 2021 21:42:56 -0500 Subject: [PATCH] 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. --- gcc/analyzer/engine.cc | 1 + gcc/testsuite/gcc.dg/analyzer/pr98564.c | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr98564.c 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'" } */ -- 2.30.2