/* >>>------------------------------------------------------------ * * File: rule_11.3.c, Module: M2CM-3.2-QAC-8.1.2 * * RULE 11.3 (Advisory): * A cast should not be performed between a pointer type and an * integral type. * * Implemented by messages: * 303 [I] Cast between a pointer to volatile object and an * integral type. * * 305 [I] Cast between a pointer to function and an integral * type. * * 306 [I] Cast between a pointer to object and an integral * type. * * 360 An expression of pointer type is being converted to type * _Bool on assignment. * * 361 An expression of pointer type is being cast to type * _Bool. * * 362 An expression of essentially Boolean type is being cast * to a pointer. * * <<<------------------------------------------------------------ */ /* PRQA S 2961,2981,2982,2983,3112 ++ */ #include "misra.h" #include "m2cmex.h" extern S16 test_1103( void ) { U32 prtadd = 0xFFF12345U; S32 *pi; volatile S32 *pvi; void (*pf)(void); pi = (S32 *)prtadd; /* MISRA Violation */ pvi = (volatile S32 *)prtadd; /* MISRA Violation */ pf = (void (*)(void))prtadd; /* MISRA Violation */ u32a = (U32)pi; /* MISRA Violation */ u32a = (U32)pvi; /* MISRA Violation */ u32a = (U32)pf; /* MISRA Violation */ bla = pi; /* MISRA Violation */ bla = &(pi[1]); /* MISRA Violation */ (BL) pi; /* MISRA Violation */ (BL) (pi + 1); /* MISRA Violation */ (S16 *) (s16a < 0); /* MISRA Violation */ return 0; }