Problems with rule c:S5350

Hi there;

in my code I have lines like

volatile uint32_t* const pulSystimeS = (uint32_t* )0x12345678;

to get the value of an internal counter of my CPU. for this line sonar created the issue

*# Make the type of this variable a pointer-to-const. The current type of “pulSystimeS” is "volatile unsigned long const".

but I have no idea why, because the value is a volatile value which cannot be a constant. Is the an idea how I can solve this issue or is it a bug in the developer version of the C sensor?

I’m using the Developer Edition - Version 9.7.1 (build 62043) of SonarQube …

Best regards,
Ralf Ebert

1 Like

Hi Ralf,

Welcome to the community!

Your version is past EOL. Can you upgrade and see if this is still replicable? Your upgrade path is:

9.7.1 → 9.9 → 10.1 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

 
Ann

Hi Ann,

meanwhile we have updated to v.9.9.1 but unfortunately the behavior hasn’t changed.

Is there anything else I can do to help to solve the problem?

Best regards,
Ralf

Hi Ralf,

Thanks for confirming. I’ve flagged this for the language experts.

 
Ann

Hi @Ralf_Ebert ,
Indeed we have a false positive on this rule. I created a ticket to fix this.
Thanks for raising the issue!