xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_142.c (revision d16b7486a53dcb8072b60ec6fcb4373a2d0c27b7)
1 /*	$NetBSD: msg_142.c,v 1.11 2023/07/09 11:01:27 rillig Exp $	*/
2 # 3 "msg_142.c"
3 
4 // Test for message: operator '%s' produces floating point overflow [142]
5 
6 /* lint1-extra-flags: -X 351 */
7 
8 /*
9  * VAX has floating point formats with different limits than the other
10  * platforms, which all implement IEEE 754.
11  */
12 /* xlint1-skip-if: vax */
13 
14 /*
15  * For 96-bit and 128-bit floating point numbers, a different number of
16  * multipliers is needed to produce an overflow.
17  */
18 
19 /* expect+2: warning: operator '*' produces floating point overflow [142] */
20 /* expect+1: warning: operator '*' produces floating point overflow [142] */
21 double dbl = 1e100 * 1e100 * 1e100 * 1e100 * 1e100;
22 
23 /*
24  * Ensure that an addition in the complex number space doesn't generate
25  * wrong warnings. Lint doesn't model complex constants accurately.
26  */
27 double _Complex complex_sum = 1e308 + 1e308i;
28