1 /* 20050922-1.c does not trigger the expand_shift rotate bug on sh4-elf, but 2 this does. */ 3 4 /* { dg-do run } */ 5 /* { dg-options "-O1 -std=c99" } */ 6 7 #include <stdlib.h> 8 9 #if __INT_MAX__ == 2147483647 10 typedef unsigned int uint32_t; 11 #elif __LONG_MAX__ == 2147483647 12 typedef unsigned long uint32_t; 13 #else 14 #error unable to find 32-bit integer type 15 #endif 16 17 #define rotl(x,n) (((x) << ((int)(n))) | ((x) >> (32 - (int)(n)))) 18 19 uint32_t f(uint32_t a,uint32_t b)20f (uint32_t a, uint32_t b) 21 { 22 23 b = rotl (a, b & 31); 24 return b; 25 } 26 27 int main()28main () 29 { 30 if (f(2,31) != 1) 31 abort (); 32 exit (0); 33 } 34