Causes warning:
tmp.c:14:36: warning: The address of variable 'x' might be accessed at non-zero index. [objectIndex]
Check(pData[i] != pData[j]);
^
tmp.c:22:16: note: Address of variable taken here.
CheckArr(1,&x);
^
tmp.c:22:16: note: Calling function 'CheckArr', 2nd argument '&x' value is lifetime=x
CheckArr(1,&x);
^
tmp.c:14:36: note: The address of variable 'x' might be accessed at non-zero index.
Check(pData[i] != pData[j]);
^
Cppcheck 2.21
I think it is a false warning, the inner loop is not called at all.
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
following code:
Causes warning:
tmp.c:14:36: warning: The address of variable 'x' might be accessed at non-zero index. [objectIndex]
Check(pData[i] != pData[j]);
^
tmp.c:22:16: note: Address of variable taken here.
CheckArr(1,&x);
^
tmp.c:22:16: note: Calling function 'CheckArr', 2nd argument '&x' value is lifetime=x
CheckArr(1,&x);
^
tmp.c:14:36: note: The address of variable 'x' might be accessed at non-zero index.
Check(pData[i] != pData[j]);
^
Cppcheck 2.21
I think it is a false warning, the inner loop is not called at all.
Martin
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14867