public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/6607: Inconsisitency using right shift operator (signed vs. unsigned shift)
@ 2002-05-08 10:16 wheisler
0 siblings, 0 replies; 3+ messages in thread
From: wheisler @ 2002-05-08 10:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 6607
>Category: c
>Synopsis: Inconsisitency using right shift operator (signed vs. unsigned shift)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed May 08 10:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Bill Heisler
>Release: gcc 2.96 20000731
>Organization:
>Environment:
RH 7.1 Intel Glibc 2.2.3-16 gcc 2.96
>Description:
When using a right shift operator that can be calculated at compile time, the operator performs an unsigned shift (prepends zeros). If the shift is parameterized, and is calculated at run time, a signed shift is performed (prepends high order bit).
>How-To-Repeat:
#include <stdio.h>
int main (int argc, char ** argv) {
unsigned int i = 0xffffffff >> 32;
unsigned int j = 0xffffffff;
j = j >> 32;
printf("i -- %x\nj -- %x\n", i, j);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c/6607: Inconsisitency using right shift operator (signed vs. unsigned shift)
@ 2002-05-09 23:04 neil
0 siblings, 0 replies; 3+ messages in thread
From: neil @ 2002-05-09 23:04 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, wheisler
Synopsis: Inconsisitency using right shift operator (signed vs. unsigned shift)
State-Changed-From-To: feedback->closed
State-Changed-By: neil
State-Changed-When: Thu May 9 23:04:06 2002
State-Changed-Why:
Not a bug. This is undefined behaviour.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6607
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c/6607: Inconsisitency using right shift operator (signed vs. unsigned shift)
@ 2002-05-08 10:38 neil
0 siblings, 0 replies; 3+ messages in thread
From: neil @ 2002-05-08 10:38 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, wheisler
Synopsis: Inconsisitency using right shift operator (signed vs. unsigned shift)
State-Changed-From-To: open->feedback
State-Changed-By: neil
State-Changed-When: Wed May 8 10:38:30 2002
State-Changed-Why:
Can you reproduce this behaviour for a shift of less than 32 bits?
A shift of the same number of bits as the width of the
type gives undefined behaviour, so the testcase you post
is not a bug as-is.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6607
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-05-10 6:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-08 10:16 c/6607: Inconsisitency using right shift operator (signed vs. unsigned shift) wheisler
2002-05-08 10:38 neil
2002-05-09 23:04 neil
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).