1 #define MAX (sizeof(int) * __CHAR_BIT__) 2 lmax(int a)3static int lmax(int a) 4 { 5 return 1 << MAX; 6 } 7 lneg(int a)8static int lneg(int a) 9 { 10 return 1 << -1; 11 } 12 rmax(int a)13static int rmax(int a) 14 { 15 return 1 >> MAX; 16 } 17 rneg(int a)18static int rneg(int a) 19 { 20 return 1 >> -1; 21 } 22 23 /* 24 * check-name: bad-shift 25 * check-command: test-linearize -Wno-decl $file 26 * 27 * check-output-start 28 lmax: 29 .L0: 30 <entry-point> 31 shl.32 %r1 <- $1, $32 32 ret.32 %r1 33 34 35 lneg: 36 .L2: 37 <entry-point> 38 shl.32 %r3 <- $1, $0xffffffff 39 ret.32 %r3 40 41 42 rmax: 43 .L4: 44 <entry-point> 45 asr.32 %r5 <- $1, $32 46 ret.32 %r5 47 48 49 rneg: 50 .L6: 51 <entry-point> 52 asr.32 %r7 <- $1, $0xffffffff 53 ret.32 %r7 54 55 56 * check-output-end 57 * 58 * check-error-start 59 expand/bad-shift.c:5:21: warning: shift too big (32) for type int 60 expand/bad-shift.c:10:21: warning: shift count is negative (-1) 61 expand/bad-shift.c:15:21: warning: shift too big (32) for type int 62 expand/bad-shift.c:20:21: warning: shift count is negative (-1) 63 * check-error-end 64 */ 65