https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80138
--- Comment #3 from Julien Pommier <julienpommier at free dot fr> --- I agree spurious was not the right wording, sorry for that. However it took me quite a lot of time to understand and to find out which function was responsible for the warning in my original code, which was more convoluted than my test case. Basically gcc was not reporting the warning as occuring in the 'main' equivalent of the test case but in another function that was calling 'main', so I had to perform some dichotomy by commenting random code in the function calling 'main' in order to determine that it was 'main' the responsible for the calls to 'contains()'. So I think that gcc should really keep quiet on this kind of code, and if it does not it should give the complete list of function calls between the 'In function int main()' part of the diagnostic and and the 'assuming signed overflow .. ' , otherwise it can be very confusing.