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.

 采纳的回答

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