https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78665
Marc Glisse <glisse at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- Well, this warning is emitted by the VRP pass deep inside the optimization pipeline. It points at the comparison that it is transforming, but it is doing that transformation assuming that some operations elsewhere (possibly in some other function, after inlining) did not overflow. Reducing the testcase, or looking at the file produced by -fdump-tree-vrp-all, may help locate that operation. Note that the warning says: "if you have undefined behavior, I'll take advantage of it, otherwise, you are fine", which makes it not so useful, and it can be hard to rewrite the code to avoid the warning, so I usually just disable this warning. I'd rather run some tests with -fsanitize=undefined once in a while. In my opinion, the non-GENERIC parts of this warning should all require -Wstrict-overflow=n with n>1 so they are not enabled by -Wall. And it would be good to add a note to the warning pointing at one (all?) possibly overflowing operation used in this optimization.