Local Variable was change range value but not assigned

1 view (last 30 days)
Tran Thang
Tran Thang on 15 Dec 2020
Edited: Tran Thang on 30 Dec 2020
Hi Matlab Support teams!
I'm using Polyspace R2019a, and i got a problem about local Variable
At line 5970, range value of local variable "u1t_InRnewEndPntIdx" = [0..8],
Please take a look following pic 1:
But at line 5980, range value of local variable "u1t_InRnewEndPntIdx" = [0..17]
Please take a look following pic 2:
u1t_InRnewEndPntIdx is not updated or assigned from line 5971 to 5980, why does it change range value?
Please help me answer the question above.
BR
Hoang Hiep

Accepted Answer

Anirban
Anirban on 16 Dec 2020
Hi,
One of the reasons could be that Code Prover is considering the case where the if branch, where u1t_InRnewEndPntIdx is assigned (line 5970), is bypassed. So the range outside the for loop is a combination of ranges in the if branch and any range u1t_InRnewEndPntIdx had before the for loop.
There is something you can try. Place this line:
#pragma Inspection_Point u1t_InRnewEndPntIdx
in the else branch with the break and see the tooltip on u1t_InRnewEndPntIdx. This might help you confirm this hypothesis.
  8 Comments
Tran Thang
Tran Thang on 30 Dec 2020
Hi Anirban !
I see CP result that have full source?, Besides I can't decide whether given it to Technical Support .
Your answer also help me workaround and solve it partly.
From the bottom, Thank you for your answer.
BR

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by