Code Power judge color warning that is not consistent
1 view (last 30 days)
Show older comments
Hi @Anirban,
I'm counting number of orange warnings. I'm confusing the result of orange warnings from Code Power.
At version 2.2.12, Line 453 have 2 warnings that consis of a orange(Non-initialized variable) and a green(Illegally dereferenced pointer). Please take a look shoot pic below:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/675823/image.png)
At version 2.2.17, Line 929 have 2 warnings that consis of a orange(Non-initialized variable) and a orange(Illegally dereferenced pointer). Please take a look shoot pic below:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/675828/image.png)
Line 453 of version 2.2.12 and Line 929 of version 2.2.17, Array ptt_mappdata and variable u2t_index_x are same size of array and value correspondingly.
Please let me know why Code Power judge color warning that is not consistent (
- 453 Illegally dereferenced pointer in version 2.2.12: Green
- 929 Illegally dereferenced pointer in version 2.2.17: Orange)
Br/ Thang Tran
2 Comments
Anirban
on 7 Jul 2021
Hi,
I am not sure I recognize the version numbers. As far as I know, version 2.2 corresponds to release 2016b. Are you speaking of two different releases or updates to one release?
Also, can you give a little more information on which variable is non-initialized? Which variable does the orange warning refer to?
Answers (1)
Anirban
on 9 Jul 2021
Edited: Anirban
on 9 Jul 2021
Hi,
Are you sure u2t_index_x has the exact same range of values on line 453 in one version and line 929 in the other version? If you hover on u2t_index_x, you should see the range of values.
Is ptt_mappdata dynamically allocated? This means that its size changes during its lifetime. Is the allocation happening the exact same way in both versions? I cannot tell from the screenshots alone.
In other words, the way you reasoned was the following: since the array size and index are the same in both versions, the check color should not have changed. Since the code changed significantly (line 453 in one version and line 929 in the other), I cannot confirm your assertion about array size and index staying the same, based on the screenshots of the lines alone. You can try to confirm this yourself by trying to look for answers to the above two questions.
Another approach (other than contacting Support) would be to see the error call graphs for the Illegally dereferenced pointer-s in both versions. Is it the same function sequence that leads to the check in both versions?
- If the function sequences are not the same, maybe now you can trace the orange to some new function call that happened.
- If the function sequences are the same, then it gets harder. You have to do a diff of the functions in that call sequence between the two versions of the code and see whether stuff that changed between the versions affects the array access.
0 Comments
See Also
Categories
Find more on Concurrency Defects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!