Open
Description
Description of the false positive
CodeQL complains "Comparison is always true because i <= 1. "
However, it is really a loop over 4 elements.
I suspect the problem is that
struct foo
{
...
unsigned long (*fnptr_array[4])(void);
...
};
describes an array of 4 function pointers, but that CodeQL isn't evaluating sizeof
correctly on the type.
Code samples or links to source code
but I've done a simpler example in https://godbolt.org/z/9fGr51r68 if that helps
URL to the alert on GitHub code scanning (optional)