Created attachment 25457
HTML output of scan-build
Hi there,
I have scan-build reporting a false positive. I am not 100% sure though, since this code is a bit over my head and my analysis might have been wrong.
What I did so far:
I ran valgrind --track-origins=yes --leak-check=full and
the address sanitizer (-O1 -g -fsanitize=address -fno-omit-frame-pointer)
over the code and they did not complain.
Looking through the report I think it might indeed be a bug in scan-build (although it might not be easily fixable and might have to be reported to boost signals2/smart_ptr instead).
I have attached the generated html output, the cpp in question is:
#include <boost/signals2.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>
using namespace boost;
using namespace boost::signals2;
using namespace std;
signal<void ()> SigA;
struct ClassB
{
void PrintFoo() { cout << "Foo" << endl; }
};
int main()
{
ClassB b;
SigA.connect(bind(&ClassB::PrintFoo, &b));
}
and scan-build reports:
scan-build: Using '/usr/bin/clang-13' for static analysis
In file included from test.cpp:1:
In file included from /usr/include/boost/signals2.hpp:15:
In file included from /usr/include/boost/signals2/deconstruct.hpp:28:
In file included from /usr/include/boost/shared_ptr.hpp:17:
In file included from /usr/include/boost/smart_ptr/shared_ptr.hpp:17:
/usr/include/boost/smart_ptr/detail/shared_count.hpp:586:22: warning: Use of memory after it is freed [cplusplus.NewDelete]
if(pi_ != 0) pi_->weak_release();
^~~~~~~~~~~~~~~~~~~
1 warning generated.
scan-build: Analysis run complete.
scan-build: 1 bug found.
scan-build: Run 'scan-view /tmp/scan-build-2021-11-18-124707-36387-1' to examine bug reports.
Please let me know what you need and whether I should report this to boost instead.
report-496700.html
(378600 bytes, text/html)Created attachment 25457 HTML output of scan-build
Hi there,
I have scan-build reporting a false positive. I am not 100% sure though, since this code is a bit over my head and my analysis might have been wrong.
What I did so far:
Looking through the report I think it might indeed be a bug in scan-build (although it might not be easily fixable and might have to be reported to boost signals2/smart_ptr instead).
I have attached the generated html output, the cpp in question is:
and scan-build reports:
Please let me know what you need and whether I should report this to boost instead.