Hello! We are using cppcheck for our codebase and we get this strange error since the check was introduced in 1.88.
I managed to reduce it to a somewhat small code example.
Is this a false positive, or I am not seeing something?
Changing std::map to an array removes the error from check.
Changing the map to <int, int> does not produce an error as well.
Get this error twice here, on assigning indices 1 and 2. In our real code, there are dozens of those errors that look unjustified.
Edit: adding the errors. [TestApp.cpp:33] (error) The address of local variable 'm_ObjectDummy' is accessed at non-zero index. [objectIndex] [TestApp.cpp:34] (error) The address of local variable 'm_ObjectDummy' is accessed at non-zero index. [objectIndex]
Sergey; if you want a trac account I can create it for you.. please generate a htpasswd hash and send it to me. You can generate it locally on your computer or online (google "htpasswd generator").
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello! We are using cppcheck for our codebase and we get this strange error since the check was introduced in 1.88.
I managed to reduce it to a somewhat small code example.
Is this a false positive, or I am not seeing something?
Changing std::map to an array removes the error from check.
Changing the map to
<int, int>
does not produce an error as well.Get this error twice here, on assigning indices 1 and 2. In our real code, there are dozens of those errors that look unjustified.
Edit: adding the errors.
[TestApp.cpp:33] (error) The address of local variable 'm_ObjectDummy' is accessed at non-zero index. [objectIndex]
[TestApp.cpp:34] (error) The address of local variable 'm_ObjectDummy' is accessed at non-zero index. [objectIndex]
Thank you.
Last edit: Sergey Burgsdorf 2019-12-24
This is a false positive. I created a ticket here:
https://trac.cppcheck.net/ticket/9554
Thank you Paul, also thanks for further reducing it.
I will ask for a trac account, since I have a few more.
Sergey; if you want a trac account I can create it for you.. please generate a htpasswd hash and send it to me. You can generate it locally on your computer or online (google "htpasswd generator").