xref: /netbsd/tests/usr.bin/xlint/lint1/op_shl_lp64.c (revision ea649623)
1 /*	$NetBSD: op_shl_lp64.c,v 1.5 2023/03/28 14:44:35 rillig Exp $	*/
2 # 3 "op_shl_lp64.c"
3 
4 /*
5  * Before decl.c 1.215 from 2021-07-31, lint wrongly treated __uint128_t and
6  * __int128_t as being equivalent to a missing type specifier, thereby
7  * defaulting to int.  This led to warnings like:
8  *
9  *	shift amount 105 is greater than bit-size 32 of 'int' [122]
10  *
11  * These warnings had been discovered in ecp_nistp256.c(296).
12  */
13 
14 /* lint1-only-if: lp64 */
15 /* lint1-extra-flags: -X 351 */
16 
17 const __uint128_t zero105 =
18     (((__uint128_t)1) << 105)
19     - (((__uint128_t)1) << 41)
20     - (((__uint128_t)1) << 9);
21 
22 const __uint128_t shl_128_129 =
23     /* expect+1: warning: shift amount 128 equals bit-size of '__uint128_t' [267] */
24     (((__uint128_t)1) << 128)
25     /* expect+1: warning: shift amount 129 is greater than bit-size 128 of '__uint128_t' [122] */
26     - (((__uint128_t)1) << 129);
27