This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/28195] New: << (shift operator) does rotate operation


When shift count is the same as the length of a variable (eg, l << 32 where
long int l;), this doesn't return 0, instead it returns a rotated value.

Below is assumed to return 0, but actually returns 2468.

---t2.c---(test case)
#include <stdio.h>

long long ll;
long l;

int
main(){
  l = 1234;
  ll = l << 33;
  printf("%lld\n", ll);

  return 0;
}
--------------------


-- 
           Summary: << (shift operator) does rotate operation
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tetsuji dot rai at gmail dot com
 GCC build triplet: ia32 Gentoo Linux
  GCC host triplet: ia32 Gentoo Linux
GCC target triplet: ia32 Gentoo Linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]