// test.c                                                                     
#include <stdio.h>                                                            

int main() {                                                                  
  unsigned long long x = 3264;                                                
  printf("%llu\n", 5LLu >> (x + 0)); // 5LLU >> (x + 0) == 5 ???              
  printf("%llu\n", 5LLu << (x + 0)); // 5LLU << (x + 0) == 5 ???              
}                                                                             

// $ echo $MACHTYPE; gcc --version; gcc test.c; ./a.out                       
// i486-pc-linux-gnu                                                          
// gcc (Debian 4.3.2-1.1) 4.3.2                                               
// Copyright (C) 2008 Free Software Foundation, Inc.                          
// This is free software; see the source for copying conditions.  There is NO 
// warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

// 5                                                                          
// 5


-- 
           Summary: incorrect unsigned long long left/right shift
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kaizhu256 at gmail dot com
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


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

Reply via email to