Home | History | Annotate | Line # | Download | only in lint1
      1 /*	$NetBSD: msg_048.c,v 1.6 2022/06/20 21:13:36 rillig Exp $	*/
      2 # 3 "msg_048.c"
      3 
      4 // Test for message: enumeration value '%s' overflows [48]
      5 
      6 /*
      7  * Before decl.c 1.269 from 2022-04-08, the comparison for enum constant
      8  * overflow was done in signed arithmetic, and since 'enumval' wrapped
      9  * around, its value became INT_MIN, at least on platforms where integer
     10  * overflow was defined as 2-complements wrap-around.  When comparing
     11  * 'enumval - 1 == TARG_INT_MAX', there was another integer overflow, and
     12  * this one was optimized away by GCC, taking advantage of the undefined
     13  * behavior.
     14  */
     15 enum int_limits {
     16 	MAX_MINUS_2 = 0x7ffffffd,
     17 	MAX_MINUS_1,
     18 	MAX,
     19 	/* expect+1: warning: enumeration value 'MIN' overflows [48] */
     20 	MIN,
     21 	MIN_PLUS_1
     22 };
     23