Illegally dereferenced pointer may be incorrect

17 views (last 30 days)
Tran Thang
Tran Thang on 30 Dec 2020
Commented: Tran Thang on 22 Feb 2021
Hi Technical Support Team
I got a concern about orange warning at line 1065. Because array u1t_ArSrcSignalData[] is not NULL and index of it as 0.
Why Code Power throw out the orange warning at there?
Please take a look pic:
Please take a look pic below to see tooltip to get more info:
  1 Comment
Tran Thang
Tran Thang on 30 Dec 2020
Hi Technical Support Team
I add lines of code to check u1t_ArSrcSignalData != NULL before used it.
But CP still throw out the orange warning.
Please help me how to disappear this warning?
BR

Sign in to comment.

Accepted Answer

Anirban
Anirban on 7 Jan 2021
The orange warning does not mean that the pointer is null. In fact, you can see in the message that the pointer is not null. (This is also why your later if statement appeared grey since the if condition is always true.)
The orange warning appears because the pointer is suspected to be pointing outside the allowed buffer. The part of the message that says "may be outside bounds" indicates this.
The other things that I can deduce from the message are:
  • The pointer might be some kind of a global pointer, since it points to what appears like local variables in different functions.
  • The second line of the message indicating "If appropriate, applying DRS to ..." indicates that the tool is having to make an assumption on that particular line for the variable pu1t_SignalData (because its value is not known), which leads to a possibly imprecise result. You can externally constrain this variable if you want and that might lead to the orange going away. See Specify External Constraints.
However, since the tool deduces that there are 67 (!) different candidates for what the pointer might point to, I am inclined to think there might be an overapproximation happening somewhere in the middle too. This will require deeper investigation.
  3 Comments
Tran Thang
Tran Thang on 22 Feb 2021
Thank you for your answer.
My side only take care orange and analyze it if it is defect or not.
"If appropriate, applying DRS to ..." is happened randomly, So we can't count and control this warning.
It make us confuse whether changed source affect to it or not.
BR/ Thang Tran

Sign in to comment.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by