I downloaded 2.17.0 and tried it. I got a warning from cppcheck on some code that I then tried to minimize to the following: https://godbolt.org/z/cKeEePGz4
It might be considered strange code, but it is mostly for demonstration purpose.
The length of the std::array is 6 * sizeof(uint16_t), aka 12. But cppcheck warns that the array is only 6 positions, and hence signals out-of-bounds. If I give the length of the array directly as 12, it works.
Thanks,
/Stefan Petersen
Last edit: Stefan Petersen 2025-02-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I downloaded 2.17.0 and tried it. I got a warning from cppcheck on some code that I then tried to minimize to the following:
https://godbolt.org/z/cKeEePGz4
It might be considered strange code, but it is mostly for demonstration purpose.
The length of the std::array is 6 * sizeof(uint16_t), aka 12. But cppcheck warns that the array is only 6 positions, and hence signals out-of-bounds. If I give the length of the array directly as 12, it works.
Thanks,
/Stefan Petersen
Last edit: Stefan Petersen 2025-02-24
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/13654
Thank you for fixing a ticket. And thank you for cppcheck.
/Stefan Petersen