Bug Finder reports false positive MISRA violation 5-0-15 on restrict pointers

3 vues (au cours des 30 derniers jours)
Thomas EB
Thomas EB le 20 Juin 2018
We are using Bug Finder to check against MISRA C++ rules. Since switching from 2015a to 2017b we face many false positive findings of rule 5-0-15 ("Array indexing shall be the only form of pointer arithmetic") which were not reported as violations earlier.
Example code:
#ifdef _TMS320C6X
#define RESTRICT restrict
#else
#define RESTRICT
#endif
tUInt32 array[1000];
tUInt32* pointerA = &array[0];
pointerA[10] = 1U; // no violation
tUInt32* RESTRICT pointerB = &array[0];
pointerB[10] = 1U; // MISRA violation 5-0-15
In our understanding, accessing an array using a restrict pointer and square-bracket notation should not violate the rule 5-0-15 as it this exactly array indexing.
Thanks for your assistance. Thomas

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by