public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31656]  New: Left shift error
@ 2007-04-22 11:15 myprasanna at gmail dot com
  2007-04-22 11:19 ` [Bug c++/31656] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: myprasanna at gmail dot com @ 2007-04-22 11:15 UTC (permalink / raw)
  To: gcc-bugs

Left shift of width 32, 33, 64, 65 etc produces inconsistencies.

const int j = 33;
printf("%d\n", 1 << j);
Output:
0

int j = 33;
printf("%d\n", 1 << j);
Output:
2

Same with C. Runtime shift instruction emmitted incorrectly.


-- 
           Summary: Left shift error
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: myprasanna at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31656


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/31656] Left shift error
  2007-04-22 11:15 [Bug c++/31656] New: Left shift error myprasanna at gmail dot com
@ 2007-04-22 11:19 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-22 11:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-04-22 12:19 -------
No, this code is undefined by both the C and C++ standards.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31656


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-22 11:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-22 11:15 [Bug c++/31656] New: Left shift error myprasanna at gmail dot com
2007-04-22 11:19 ` [Bug c++/31656] " pinskia 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).