[Bug tree-optimization/52904] -Wstrict-overflow false alarm with bounded loop

Laurent.Rineau__gcc at normalesup dot org gcc-bugzilla@gcc.gnu.org
Thu Dec 12 18:19:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904

--- Comment #7 from Laurent Rineau <Laurent.Rineau__gcc at normalesup dot org> ---
In the test case, nfds cannot overflow, because of two reasons:
  - nfds is only incremented from 0, and -fstrict-overflow allows gcc to
suppose it will not overflow,
  - the number of iterations of the loop cannot allow nfds to overflow, even
without -fstrict-overflow.

Gcc warns that the test (nfds < 0) is useless, because of -fstrict-overflow.
The developer has two solutions:
  - remove that test,
  - or compile with -fno-strict-overflow.



More information about the Gcc-bugs mailing list