Hello
I get an uninitVar message from this code: (uint32 is a typedef for unsigned long)
volatile uint32* pIPIVPR; switch (GetCoreId()& 0x01) {
// default: case 0 : pIPIVPR = INOS_HW_ADDR32(DF_INOS_P2020_MPIC_IPIVPR0); break; case 1 : pIPIVPR = INOS_HW_ADDR32(DF_INOS_P2020_MPIC_IPIVPR1); break; }
*pIPIVPR &= 0x7fffffff;
Uninitialized variable: pIPIVPR
A number & 0x01 can only be two cases, 0 and 1, so the switch covers all cases. Still cppcheck thinks that pIPIVPR is uninitialized.
Adding the commented out default: case didn't help although that would catch all not handled cases.
So I think there are two problems: The value handling (& 0x01) and the switch default case which should both tell cppcheck that pIPIVPR is set.
Thanks
I can't reproduce in either C or C++ mode with 2.3.
Log in to post a comment.
Hello
I get an uninitVar message from this code:
(uint32 is a typedef for unsigned long)
// default:
case 0 : pIPIVPR = INOS_HW_ADDR32(DF_INOS_P2020_MPIC_IPIVPR0); break;
case 1 : pIPIVPR = INOS_HW_ADDR32(DF_INOS_P2020_MPIC_IPIVPR1); break;
}
Uninitialized variable: pIPIVPR
A number & 0x01 can only be two cases, 0 and 1, so the switch covers
all cases. Still cppcheck thinks that pIPIVPR is uninitialized.
Adding the commented out default: case didn't help although that would
catch all not handled cases.
So I think there are two problems: The value handling (& 0x01) and the
switch default case which should both tell cppcheck that pIPIVPR is set.
Thanks
I can't reproduce in either C or C++ mode with 2.3.