Code Power judge color warning that is not consistent

2 visualizaciones (últimos 30 días)
Tran Thang
Tran Thang el 6 de Jul. de 2021
Editada: Anirban el 9 de Jul. de 2021
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:
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:
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 comentarios
Anirban
Anirban el 7 de Jul. de 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?
Tran Thang
Tran Thang el 8 de Jul. de 2021
version 2.2 corresponds to release 2016b => No, It is my source code version. I are using PolySpace Version R2020b and run for 2 source code. I'm talking about different color in 2 source codes. I'm sure that they are same in file source libmap.c.
which variable is non-initialized? Which variable does the orange warning refer to
With source code version 2.2.12, non-initialized is ptt_mapdata[u2t_index_x] and Illegally dereferenced pointer ptt_mapdata[] is green. Please take a look shot pic below: (Focus Line 453)
With source code version 2.2.17, non-initialized is ptt_mapdata[u2t_index_x] and Illegally dereferenced pointer ptt_mapdata[] is Orange. Please take a look shot pic below: (Focus line 929)

Iniciar sesión para comentar.

Respuestas (1)

Anirban
Anirban el 9 de Jul. de 2021
Editada: Anirban el 9 de Jul. de 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.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by