diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-12-16 03:02:23 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-12-16 03:02:23 +0000 |
commit | f1d156467e7c6ba345a1cc46106184f851c0e0f5 (patch) | |
tree | 6f1024a428288d83d9611243c892586f7b8edfa1 /regress/usr.bin/xlint/test-15.c | |
parent | 8bd3ba17514484d2fad65e72dfe33a2999ba1ace (diff) |
Add a regression test for lint catching division by zero.
Diffstat (limited to 'regress/usr.bin/xlint/test-15.c')
-rw-r--r-- | regress/usr.bin/xlint/test-15.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/regress/usr.bin/xlint/test-15.c b/regress/usr.bin/xlint/test-15.c new file mode 100644 index 00000000000..3ff79a3b768 --- /dev/null +++ b/regress/usr.bin/xlint/test-15.c @@ -0,0 +1,46 @@ +/* $OpenBSD: test-15.c,v 1.1 2005/12/16 03:02:22 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 = 0 / 0; + f = 0.0f / 0.0f; + d = 0.0 / 0.0; + L = 0L / 0L; + + dbzd(0.0 / 0.0); + dbzf(0.0f / 0.0f); + dbzi(0 / 0); + dbzl(0L / 0L); + + i++; + f++; + d++; + L++; + + return 0; +} + + + |