This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/45831] 0 = 10 (with -O0, 0 = 0 with -O1, but 10 = 10 expected)
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 29 Sep 2010 14:59:22 +0000
- Subject: [Bug c/45831] 0 = 10 (with -O0, 0 = 0 with -O1, but 10 = 10 expected)
- Auto-submitted: auto-generated
- References: <bug-45831-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45831
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-09-29 14:59:22 UTC ---
(In reply to comment #4)
> In case you are missing the point, most non-bug posters compile on their target
> machine.
In C/C++, shifting by a negative number is undefined. So what that means is
that it could produce a different values on different targets and at different
times (including at different optimization level). I think we warn with either
-Wextra or -Wall when we see a negative shifting count.