diff mbox

[9/9] div0: add missing tests for floating point div by zero

Message ID 20170531032207.95830-10-luc.vanoostenryck@gmail.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Luc Van Oostenryck May 31, 2017, 3:22 a.m. UTC
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/div-by-zero-fp.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox

Patch

diff --git a/validation/div-by-zero-fp.c b/validation/div-by-zero-fp.c
index 787af1636..957bc732c 100644
--- a/validation/div-by-zero-fp.c
+++ b/validation/div-by-zero-fp.c
@@ -3,14 +3,22 @@  double gbad(double a) { return 2.0 / 0.0; }
 double fool(double a) { return a / 0; }
 double ffoo(double a) { return a / 0.0; }
 
+double fbar(double a) { if (a && 0) a / 0.0; return 0; }
+double fbaz(double a) { return a /= 0.0; }
+double fquz(double a) { return a / (a && 0); }
+
 /*
  * check-name: div-by-zero-fp.c
  * check-command: sparse -Wno-decl $file
+ * check-known-to-fail
  *
  * check-error-start
 div-by-zero-fp.c:1:36: warning: division by zero
 div-by-zero-fp.c:2:36: warning: division by zero
 div-by-zero-fp.c:3:34: warning: division by zero
 div-by-zero-fp.c:4:34: warning: division by zero
+div-by-zero-fp.c:6:39: warning: division by zero
+div-by-zero-fp.c:7:34: warning: division by zero
+div-by-zero-fp.c:8:34: warning: division by zero
  * check-error-end
  */