summaryrefslogtreecommitdiff
path: root/regress/usr.bin/xlint/test-15.c
blob: 7bc6a5d0d4033ce6c411b1b2f7719c878987320e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*	$OpenBSD: test-15.c,v 1.2 2005/12/17 20:05:49 cloder Exp $	*/

/*
 * Placed in the public domain by Chad Loder <cloder@openbsd.org>.
 *
 * Test lint dealing with division by zero.
 */

/* ARGSUSED */
void dbzd(double d) { }
/* ARGSUSED */
void dbzf(float f) { }
/* ARGSUSED */
void dbzi(int i) { }
/* ARGSUSED */
void dbzl(long L) { }

/*ARGSUSED*/
int
main(int argc, char* argv[])
{
	double d;
	long L;
	int i;
	float f;

	i = 1 / 0;
	f = 1.0f / 0.0f;
	d = 1.0 / 0.0;
	L = 1L / 0L;

	dbzd(1.0 / 0.0);
	dbzf(1.0f / 0.0f);
	dbzi(1 / 0);
	dbzl(1L / 0L);

	i = 1 % 0;
	L = 1L % 0L;

	i++;
	f++;
	d++;
	L++;

	return 0;
}