This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/28777] Zerodetection (i != 0) compiled with -O2 don't work
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Aug 2006 05:03:46 -0000
- Subject: [Bug tree-optimization/28777] Zerodetection (i != 0) compiled with -O2 don't work
- References: <bug-28777-13115@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-08-21 05:03 -------
(In reply to comment #2)
> It is signed overflow being undefined and so the i == 0 test being optimized
> away.
> Use -fwrapv or an unsigned loop counter.
And the "!= 0" is being optimized to 1 because signed overflow is undefined.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28777