[Bug analyzer/93959] g++.dg/analyzer/malloc.C FAILs
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 2 21:42:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93959
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:
https://gcc.gnu.org/g:9f00b22f98ec0688fcd9816a03aa3f7eea58bcf7
commit r10-6981-g9f00b22f98ec0688fcd9816a03aa3f7eea58bcf7
Author: David Malcolm <dmalcolm@redhat.com>
Date: Thu Feb 27 14:19:33 2020 -0500
analyzer: detect malloc, free, calloc within "std" [PR93959]
PR analyzer/93959 reported that g++.dg/analyzer/malloc.C was failing
with no output on Solaris.
The issue is that <stdlib.h> there has "using std::free;", converting
all the "free" calls to std::free, which fails the name-matching via
is_named_call_p.
This patch implements an is_std_named_call_p variant of is_named_call_p
to check for the name within "std", and uses it in sm-malloc.c to check
for std::malloc, std::calloc, and std::free.
gcc/analyzer/ChangeLog:
PR analyzer/93959
* analyzer.cc (is_std_function_p): New function.
(is_std_named_call_p): New functions.
* analyzer.h (is_std_named_call_p): New decl.
* sm-malloc.cc (malloc_state_machine::on_stmt): Check for "std::"
variants when checking for malloc, calloc and free.
gcc/testsuite/ChangeLog:
PR analyzer/93959
* g++.dg/analyzer/cstdlib-2.C: New test.
* g++.dg/analyzer/cstdlib.C: New test.
More information about the Gcc-bugs
mailing list