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 ExchangeIntroduction 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