aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
Diffstat (limited to 'validation')
-rw-r--r--validation/infinite-loop02.c11
-rw-r--r--validation/infinite-loop03.c16
2 files changed, 27 insertions, 0 deletions
diff --git a/validation/infinite-loop02.c b/validation/infinite-loop02.c
new file mode 100644
index 00000000..7d0761d8
--- /dev/null
+++ b/validation/infinite-loop02.c
@@ -0,0 +1,11 @@
+void foo(void)
+{
+ int a = 1;
+ while ((a = !a))
+ ;
+}
+
+/*
+ * check-name: infinite loop 02
+ * check-command: sparse -Wno-decl $file
+ */
diff --git a/validation/infinite-loop03.c b/validation/infinite-loop03.c
new file mode 100644
index 00000000..ac8a9519
--- /dev/null
+++ b/validation/infinite-loop03.c
@@ -0,0 +1,16 @@
+static void foo(int *buf)
+{
+ int a = 1;
+ int *b;
+ do {
+ if (a)
+ b = buf;
+ if (a)
+ *buf = 0;
+ } while (!(a = !a));
+}
+
+/*
+ * check-name: infinite loop 03
+ * check-command: sparse -Wno-decl $file
+ */