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.

 Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 27 Jun. 2009

0 Stimmen

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.

Weitere Antworten (0)

Kategorien

Produkte

Version

Noch keine Version eingegeben.

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by