INPUTS AND STUBBING: INIT GLOBAL VARIABLES THROUGH CONSTRAIN_SETUP

조회 수: 8 (최근 30일)
Tran Thang
Tran Thang 2021년 6월 1일
댓글: Anirban 2021년 6월 18일
How to init global variables with specific size by Input + Stubbing?
I have tried to do it through constrain setup, but i seems not work. The orange warning still happend after i init for ponter input.
here is my config, please help me if you can.
Sincerely,

채택된 답변

Anirban
Anirban 2021년 6월 8일
편집: Anirban 2021년 6월 8일
You initialized argument 1 of function Bcd_copysignal with the following constraints:
  • The pointer is not NULL.
  • The pointer is actually an array with multiple elements.
  • The array has max elements.
Assuming ult_ArDstSignalData is that argument 1, your expectation is that the array ult_ArDstSignalData should be accessible at any index. This expectation seems to be correct. Can you show the message that you see for the Illegally dereferenced pointer warning that occurs on line 994?
Also, do you have any warnings in the analysis log that contains the text data-range-specifications?
  댓글 수: 4
Tran Thang
Tran Thang 2021년 6월 14일
Hi Anirban,
Thanks for your great support. I'd like to answer you that:
  1. After analizing data, the pointer is passed by some calls hierachy and some constrains inside these functions.
  2. I don't know how CP suggest put DRS to these ID such as 267 and 8805. So, is DRS really work in the end?
Best regard,
Anirban
Anirban 2021년 6월 18일
I cannot give a definitive answer without looking at the function call hierarchy. You can track the error call graph that leads to a given check. See Result Details.
Let us say that one of the paths that leads to the check contains the calls main -> func1 -> func2. Now, you can check whether the pointer is written explictly in the code in any of these functions (and the write operation occurs on an execution path before the check). These explicit writes will override external constraints. If the check occurs after that point, then the DRS no longer applies and will not work.
But this investigation will take some work, and I cannot give a more precise answer based on the screenshot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by