msg_120.c revision 1.6
1/* $NetBSD: msg_120.c,v 1.6 2022/06/16 16:58:36 rillig Exp $ */ 2# 3 "msg_120.c" 3 4// Test for message: bitwise '%s' on signed value nonportable [120] 5 6/* lint1-extra-flags: -p */ 7 8int 9shr(int a, int b) 10{ 11 /* expect+1: warning: bitwise '>>' on signed value possibly nonportable [117] */ 12 return a >> b; 13} 14 15int 16shr_lhs_constant_positive(int a) 17{ 18 return 0x1234 >> a; 19} 20 21int 22shr_lhs_constant_negative(int a) 23{ 24 /* expect+1: warning: bitwise '>>' on signed value nonportable [120] */ 25 return -0x1234 >> a; 26} 27 28int 29shr_rhs_constant_positive(int a) 30{ 31 /* expect+2: warning: bitwise '>>' on signed value possibly nonportable [117] */ 32 /* expect+1: warning: shift amount 4660 is greater than bit-size 32 of 'int' [122] */ 33 return a >> 0x1234; 34} 35 36int 37shr_rhs_constant_negative(int a) 38{ 39 /* expect+2: warning: bitwise '>>' on signed value possibly nonportable [117] */ 40 /* expect+1: warning: negative shift [121] */ 41 return a >> -0x1234; 42} 43