Hello and thank you for producing such a fantastic open source product! I have, however, discovered the following issue. Consider the following snippet:
#defineXFD_MAX_CARDS16typedefstruct{int*cards[XFD_MAX_CARDS];}xfd_gauge_carddeck;intiterate_cards(xfd_gauge_carddeck*carddeck,intall,intsticky){intret=0;/* Note: Does not generate false positive if you put XFD_MAX_CARDS in place of (sizeof(carddeck->cards)/sizeof(carddeck->cards[0])) */if(!all&&(sticky>-1)&&(sticky<(sizeof(carddeck->cards)/sizeof(carddeck->cards[0])))){if(carddeck->cards[sticky])printf("value is %d\n",*carddeck->cards[sticky]);}returnret;}
The above snippet kicks out an arrayIndexOutOfBoundsCond in cppcheck 2.9. Notably, using XFD_MAX_CARDS in place of the sizeof() math to generate the top end value clears the error.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello and thank you for producing such a fantastic open source product! I have, however, discovered the following issue. Consider the following snippet:
The above snippet kicks out an arrayIndexOutOfBoundsCond in cppcheck 2.9. Notably, using XFD_MAX_CARDS in place of the sizeof() math to generate the top end value clears the error.
For clarity, please see the following command line and results
No repro with head, so maybe this is already fixed.