public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/43756] New: Bit shifitng by a constant 32 isn't the same as bitshifting by a variable 32.
@ 2010-04-15 3:31 mail dot alexhaase at gmail dot com
2010-04-15 3:32 ` [Bug c/43756] " mail dot alexhaase at gmail dot com
2010-04-15 9:27 ` rguenth at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: mail dot alexhaase at gmail dot com @ 2010-04-15 3:31 UTC (permalink / raw)
To: gcc-bugs
I ran my demo code from bug id #43755 on a 32bit host for fun. All the casting
i could dream up for the value of ~0 << 32 resulted in a value of 0 when using
constants. However when using a variable to upshift by 32, I get the result ~0
(4294967295). I'm stumped.
--
Summary: Bit shifitng by a constant 32 isn't the same as
bitshifting by a variable 32.
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mail dot alexhaase at gmail dot com
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43756
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/43756] Bit shifitng by a constant 32 isn't the same as bitshifting by a variable 32.
2010-04-15 3:31 [Bug c/43756] New: Bit shifitng by a constant 32 isn't the same as bitshifting by a variable 32 mail dot alexhaase at gmail dot com
@ 2010-04-15 3:32 ` mail dot alexhaase at gmail dot com
2010-04-15 9:27 ` rguenth at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: mail dot alexhaase at gmail dot com @ 2010-04-15 3:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from mail dot alexhaase at gmail dot com 2010-04-15 03:32 -------
Created an attachment (id=20385)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20385&action=view)
a demo of this bug
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43756
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/43756] Bit shifitng by a constant 32 isn't the same as bitshifting by a variable 32.
2010-04-15 3:31 [Bug c/43756] New: Bit shifitng by a constant 32 isn't the same as bitshifting by a variable 32 mail dot alexhaase at gmail dot com
2010-04-15 3:32 ` [Bug c/43756] " mail dot alexhaase at gmail dot com
@ 2010-04-15 9:27 ` rguenth at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-15 9:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2010-04-15 09:27 -------
Shifting by an amount bigger than the width of the type invokes undefined
behavior (that is, target specific behavior in this case). We usually
try to simulate target behavior here but the i?86 architecture is inconsistent
in itself:
/* Define if shifts truncate the shift count
which implies one can omit a sign-extension or zero-extension
of a shift count. */
/* On i386, shifts do truncate the count. But bit opcodes don't. */
/* #define SHIFT_COUNT_TRUNCATED */
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
Summary|Bit shifitng by a constant |Bit shifitng by a constant
|32 isn't the same as |32 isn't the same as
|bitshifting by a variable |bitshifting by a variable
|32. |32.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43756
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-15 9:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-15 3:31 [Bug c/43756] New: Bit shifitng by a constant 32 isn't the same as bitshifting by a variable 32 mail dot alexhaase at gmail dot com
2010-04-15 3:32 ` [Bug c/43756] " mail dot alexhaase at gmail dot com
2010-04-15 9:27 ` rguenth at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).