False positive: for-loop in template class

The counter variable is not changed in the body of the for-loop!

Hey there @Skotty

Can you please provide a text-based sample of code rather than a screenshot?

(!) Your version is also past EOL. You should upgrade to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your upgrade path is:

10.3 → 2025.1

You may find these resources helpful:

If the false-positive persists after upgrade, please come back to us.

Hey Colin,

Thank you for your prompt response. No, sorry, I am not allowed to share more than a code snippet in public. (If you provide your email address, I can see what I can do.)
Also, the effort to isolate the code to a minimum example is rather high. (A build and scan cycle needs approximately an hour.) I have enough work to get our own software clean.
I would expect that you can find the problem if you look in the related check code. It is very suspicious that the command _nextIndexTable[i] = i + 1; triggers the issue. If it was i = i + 1;, the issue was justified. So, please ask yourself (with a look in your code) what could lead to this misinterpretation.

The Sonar updates are rolled out by another department. There may be dependencies why updates must be delayed. I can ask.

Regarding the update to 2025.1, I got the response from a colleague:
If the performance issues are fixed in this version, they are gladly willing to do the update. (There were Sonar versions where the scan time increased by a factor of 20 to 25.)

We’ve been some very positive feedback from our users about the performance of the new LTA (particularly in the context of this improvement. Of course, this should be tested in a non-production environment first.

I’m not a developer, but I am responsible for ensuring that our developers have the best information available so they can be effective when we ask them to contribute to our community. We have fairly stringent rules and expectations, such as making sure the issue can be reproduced using the latest supported version and providing a reproducible example, before passing issues on to our developers. That’s the reason behind our approach.

Thank you, Colin, for your comments. So, I will come back to this issue after we have installed the latest supported version.

So, the colleagues updated our Sonar server to the version 2025.1 (102418). And I removed the // NOSONAR comment behind the for-statement. The issue appears again.

I can provide you the header file (and a some example code which uses it) if you provide me your email address or another way for a non-public communication.

Hello @Skotty,

Thank you for providing me with a reduced example. I’ve been able to reproduce the issue, and to find its root cause.

I created a ticket to tackle it, you can follow its progress.

1 Like

Thank you, Loïc, for your effort. - Merci beaucoup.