How can I force Polyspace to ignore null pointer?

I am using a (UINT8)* 0x0 as an absolute address but Polyspace errors out on this due to null pointer representation.

 채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일

0 개 추천

Polyspace cannot differentiate Null pointer from Absolute adressing.
Note that, this case is referenced at page 315 in the documentation (8.2.20.1.2. The NULL pointer case). In such cases, PolySpace cannot do the difference between the NULL pointer and the absolute address which could become at address 0x0.
Intrusive way proposed with PolySpace directive flag is valid.
#ifdef PolySpace
ComputedCRC = crc32((UINT8 *)0x1000, length, 0xFFFFFFFF);
#else
ComputedCRC = crc32((UINT8 *)0, length, 0xFFFFFFFF);
#endif
The only non intrusive way is to use option -post-preprocessing-command with a script which looks like the one attached (null_addr.pl). It works with the attached example (null.c) and replaces (UINT8 *)0 by (UINT8 *)0x1.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

릴리스

아직 릴리스를 입력하지 않았습니다.

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by