https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110933
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Add warning flags to check |Add warnings to detect |against integer overflow |wrapping happening inside a | |loop (an infinite loop) Assignee|unassigned at gcc dot gnu.org |dmalcolm at gcc dot gnu.org Severity|normal |enhancement Component|c++ |analyzer --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So -Wconversion does not warn in this case as there is the conversion is being promoted rather than a truncation. That is i < n is being done in uint64_t. > find common integer overflow bugs. Again in this case there is NO integer overflow. There is only unsigned integer wrapping happening which is well defined C/C++ behavior. Just the programmer was not expecting them and maybe should be warned about but I always get the feeling this should be a -fanalyzer option as there needs to be some extra static analysis to make sure if the programmer checks for the wrapping we don't warn about it always ...