hi,
typedef struct { uint8_t padding[500]; } struct_t; static struct_t s_zero = {0}; void fun() { uint8_t *s_zero_bytes = (uint8_t*)&s_zero; for(int b=0; b<10; b++) { printf("%02x\n", s_zero_bytes[b]); } }
will give these warnings:
a.c:10:33: warning: The address of local variable 's_zero' might be accessed at non-zero index. [objectIndex] LOG("%02x", s_zero_bytes[b]); ^ a.c:8:39: note: Address of variable taken here. uint8_t *s_zero_bytes = (uint8_t*)&s_zero; ^ a.c:10:33: note: The address of local variable 's_zero' might be accessed at non-zero index. LOG("%02x", s_zero_bytes[b]);
is this a false positive?
thanks, jacob
Thanks! I agree it is a false positive. I created ticket https://trac.cppcheck.net/ticket/10133
Log in to post a comment.
hi,
will give these warnings:
is this a false positive?
thanks, jacob
Thanks! I agree it is a false positive. I created ticket https://trac.cppcheck.net/ticket/10133