This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/48197] possible wrong code bug at -O0
- From: "regehr at cs dot utah.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 18 Mar 2011 20:04:15 +0000
- Subject: [Bug c/48197] possible wrong code bug at -O0
- Auto-submitted: auto-generated
- References: <bug-48197-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48197
--- Comment #2 from John Regehr <regehr at cs dot utah.edu> 2011-03-18 20:04:04 UTC ---
(In reply to comment #1)
> x = (long)0 > ((unsigned int)0 ^ (signed short)0x8000);
> x = (long)0 > ((unsigned)0 ^ (unsigned)0x8000);
> I think you missed something here (unsigned)(signed short) still sign extends.
Thanks Andrew, I'll look more closely.
If GCC is right, then Clang and Intel CC are wrong (assuming all three
compilers make the same implementation-dependent decisions for integers on
x86-64, which I was under the impression they did).