Home | History | Annotate | Line # | Download | only in lint1
msg_117.c revision 1.3
      1 /*	$NetBSD: msg_117.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
      2 # 3 "msg_117.c"
      3 
      4 // Test for message: bitwise operation on signed value possibly nonportable [117]
      5 
      6 /* lint1-extra-flags: -p */
      7 
      8 int
      9 shr(int a, int b)
     10 {
     11 	return a >> b;			/* expect: 117 */
     12 }
     13 
     14 int
     15 shr_lhs_constant_positive(int a)
     16 {
     17 	return 0x1234 >> a;
     18 }
     19 
     20 int
     21 shr_lhs_constant_negative(int a)
     22 {
     23 	return -0x1234 >> a;		/* expect: 120 */
     24 }
     25 
     26 int
     27 shr_rhs_constant_positive(int a)
     28 {
     29 	return a >> 0x1234;		/* expect: 117, 122 */
     30 }
     31 
     32 int
     33 shr_rhs_constant_negative(int a)
     34 {
     35 	return a >> -0x1234;		/* expect: 117, 121 */
     36 }
     37