1 /* $NetBSD: expr.c,v 1.1 2024/06/08 09:09:20 rillig Exp $ */ 2 # 3 "expr.c" 3 4 /* 5 * Miscellaneous tests for expressions. 6 */ 7 8 /* lint1-extra-flags: -X 351 */ 9 10 struct bit_fields { 11 unsigned u32: 32; 12 }; 13 14 unsigned long 15 expr_cond_cvt(unsigned long ul) 16 { 17 struct bit_fields bits = { 0 }; 18 // Combining 'unsigned:32' and 'unsigned long' in the ':' operator 19 // results in 'unsigned long'. 20 return bits.u32 < ul ? bits.u32 : ul; 21 } 22 23 // Before tree.c 1.76 from 2014-04-17, lint crashed with an internal error, 24 // due to an uninitialized right operand of a tree node. 25 void 26 crash_in_assignment(void) 27 { 28 /* expect+1: warning: 'x' set but not used in function 'crash_in_assignment' [191] */ 29 double x = 1; 30 int foo = 0; 31 if (foo) 32 x = 1; 33 } 34