aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-05-13 16:29:10 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-11-13 14:16:51 +0100
commit4a51733e789de3c073e7be51f4bdb52cc66513d9 (patch)
treeb2690ac9665a7bc73748f535d2384eed33ee0f81 /validation
parent658d1ab5122840173e7cabbbc92c86ad307fbec8 (diff)
downloadsparse-dev-4a51733e789de3c073e7be51f4bdb52cc66513d9.tar.gz
add test case for missed overflow detection
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/overflow.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/validation/overflow.c b/validation/overflow.c
new file mode 100644
index 00000000..c2655e32
--- /dev/null
+++ b/validation/overflow.c
@@ -0,0 +1,19 @@
+extern int a;
+
+int a = __INT_MAX__ * 2;
+
+int foo(void)
+{
+ return __INT_MAX__ * 2;
+}
+
+/*
+ * check-name: overflow
+ * check-command: sparse -Wno-decl $file
+ *
+ * check-known-to-fail
+ * check-error-start
+bug-overflow.c:3:21: warning: integer overflow in expression
+bug-overflow.c:7:28: warning: integer overflow in expression
+ * check-error-end
+ */