aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
Diffstat (limited to 'validation')
-rw-r--r--validation/asm-bad0.c2
-rw-r--r--validation/bad-type-twice0.c3
-rw-r--r--validation/badtype2.c1
-rw-r--r--validation/badtype3.c1
-rw-r--r--validation/implicit-KR-arg-type1.c11
-rw-r--r--validation/optim/set-uimm0.c14
-rw-r--r--validation/optim/simplify-neg-add-cte.c11
-rw-r--r--validation/optim/simplify-neg-not.c9
-rw-r--r--validation/optim/simplify-neg-sub.c9
-rw-r--r--validation/optim/simplify-not-add-cte.c11
-rw-r--r--validation/optim/simplify-not-neg.c9
-rw-r--r--validation/optim/simplify-not-sub-cte.c11
-rw-r--r--validation/optim/simplify-not-xor-cte.c11
13 files changed, 98 insertions, 5 deletions
diff --git a/validation/asm-bad0.c b/validation/asm-bad0.c
index aa9bf28d..4ba78575 100644
--- a/validation/asm-bad0.c
+++ b/validation/asm-bad0.c
@@ -16,7 +16,7 @@ static void icons(void)
asm("template" : [out] "=r" (var): [in] string (0));
}
-static void oexpr(oid)
+static void oexpr(void)
{
asm("template" : [out] "=" (var[) : [in] "r" (0));
}
diff --git a/validation/bad-type-twice0.c b/validation/bad-type-twice0.c
index 9e834d47..e7ec7b75 100644
--- a/validation/bad-type-twice0.c
+++ b/validation/bad-type-twice0.c
@@ -7,7 +7,6 @@ static int foo(a)
* check-name: bad-type-twice0
*
* check-error-start
-bad-type-twice0.c:3:16: error: non-scalar type in conditional:
-bad-type-twice0.c:3:16: incomplete type a
+bad-type-twice0.c:1:16: error: missing type declaration for parameter 'a'
* check-error-end
*/
diff --git a/validation/badtype2.c b/validation/badtype2.c
index 49fec87c..173dbfda 100644
--- a/validation/badtype2.c
+++ b/validation/badtype2.c
@@ -18,6 +18,7 @@ badtype2.c:2:14: error: got bar
badtype2.c:3:14: error: Expected ; at end of declaration
badtype2.c:3:14: error: got foo
badtype2.c:6:3: error: Trying to use reserved word 'switch' as identifier
+badtype2.c:6:11: error: missing type declaration for parameter 'p'
badtype2.c:7:3: error: not in switch scope
badtype2.c:10:1: error: Expected ; at the end of type declaration
badtype2.c:10:1: error: got }
diff --git a/validation/badtype3.c b/validation/badtype3.c
index 20f346c5..c111d94e 100644
--- a/validation/badtype3.c
+++ b/validation/badtype3.c
@@ -16,6 +16,7 @@ badtype3.c:2:18: warning: identifier list not in definition
badtype3.c:2:24: error: Expected ) in function declarator
badtype3.c:2:24: error: got ,
badtype3.c:5:3: error: Trying to use reserved word 'while' as identifier
+badtype3.c:5:10: error: missing type declaration for parameter 'cur'
badtype3.c:7:7: error: break/continue not in iterator scope
badtype3.c:9:3: error: Trying to use reserved word 'return' as identifier
badtype3.c:9:10: error: Expected ; at end of declaration
diff --git a/validation/implicit-KR-arg-type1.c b/validation/implicit-KR-arg-type1.c
index fe199ef5..c7eb39ae 100644
--- a/validation/implicit-KR-arg-type1.c
+++ b/validation/implicit-KR-arg-type1.c
@@ -1,16 +1,23 @@
-int foo(a, b)
+static int foo(a, b)
int a;
{
if (b)
return a;
}
+static int bar(a)
+{
+ if (a)
+ return a;
+}
+
/*
* check-name: implicit-KR-arg-type1
* check-command: sparse -Wold-style-definition -Wimplicit-int $file
*
* check-error-start
implicit-KR-arg-type1.c:2:9: warning: non-ANSI definition of function 'foo'
-implicit-KR-arg-type1.c:1:12: error: missing type declaration for parameter 'b'
+implicit-KR-arg-type1.c:1:19: warning: missing type declaration for parameter 'b'
+implicit-KR-arg-type1.c:8:16: error: missing type declaration for parameter 'a'
* check-error-end
*/
diff --git a/validation/optim/set-uimm0.c b/validation/optim/set-uimm0.c
new file mode 100644
index 00000000..ded8fc82
--- /dev/null
+++ b/validation/optim/set-uimm0.c
@@ -0,0 +1,14 @@
+static _Bool setlt0(unsigned int a) { return (a < 0u) == 0; }
+static _Bool setge0(unsigned int a) { return (a >= 0u) == 1; }
+static _Bool setle0(unsigned int a) { return (a <= 0u) == (a == 0); }
+static _Bool setgt0(unsigned int a) { return (a > 0u) == (a != 0); }
+static _Bool setlt1(unsigned int a) { return (a < 1u) == (a == 0); }
+static _Bool setge1(unsigned int a) { return (a >= 1u) == (a != 0); }
+
+/*
+ * check-name: set-uimm0
+ * check-command: test-linearize $file
+ *
+ * check-output-ignore
+ * check-output-pattern(6): ret\\.1 *\\$1
+ */
diff --git a/validation/optim/simplify-neg-add-cte.c b/validation/optim/simplify-neg-add-cte.c
new file mode 100644
index 00000000..a02c474f
--- /dev/null
+++ b/validation/optim/simplify-neg-add-cte.c
@@ -0,0 +1,11 @@
+#define C 3
+
+int foo(int x) { return -(x + C) == (-3 - x); }
+
+/*
+ * check-name: simplify-neg-add-cte
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$1
+ */
diff --git a/validation/optim/simplify-neg-not.c b/validation/optim/simplify-neg-not.c
new file mode 100644
index 00000000..e92352cf
--- /dev/null
+++ b/validation/optim/simplify-neg-not.c
@@ -0,0 +1,9 @@
+int foo(int x) { return -(~x) == x + 1; }
+
+/*
+ * check-name: simplify-neg-not
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$1
+ */
diff --git a/validation/optim/simplify-neg-sub.c b/validation/optim/simplify-neg-sub.c
new file mode 100644
index 00000000..9a824f09
--- /dev/null
+++ b/validation/optim/simplify-neg-sub.c
@@ -0,0 +1,9 @@
+int foo(int x, int y) { return -(x - y) == (y - x); }
+
+/*
+ * check-name: simplify-neg-sub
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$1
+ */
diff --git a/validation/optim/simplify-not-add-cte.c b/validation/optim/simplify-not-add-cte.c
new file mode 100644
index 00000000..6594012b
--- /dev/null
+++ b/validation/optim/simplify-not-add-cte.c
@@ -0,0 +1,11 @@
+#define C 3
+
+int foo(int x) { return ~(x + C) == (~C - x); }
+
+/*
+ * check-name: simplify-not-add-cte
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$1
+ */
diff --git a/validation/optim/simplify-not-neg.c b/validation/optim/simplify-not-neg.c
new file mode 100644
index 00000000..3fd8400d
--- /dev/null
+++ b/validation/optim/simplify-not-neg.c
@@ -0,0 +1,9 @@
+int foo(int x) { return ~(-x) == (x - 1); }
+
+/*
+ * check-name: simplify-not-neg
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$1
+ */
diff --git a/validation/optim/simplify-not-sub-cte.c b/validation/optim/simplify-not-sub-cte.c
new file mode 100644
index 00000000..1ea73ece
--- /dev/null
+++ b/validation/optim/simplify-not-sub-cte.c
@@ -0,0 +1,11 @@
+#define C 3
+
+int foo(int x) { return ~(C - x) == (x + ~C); }
+
+/*
+ * check-name: simplify-not-sub-cte
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$1
+ */
diff --git a/validation/optim/simplify-not-xor-cte.c b/validation/optim/simplify-not-xor-cte.c
new file mode 100644
index 00000000..c3c803b3
--- /dev/null
+++ b/validation/optim/simplify-not-xor-cte.c
@@ -0,0 +1,11 @@
+#define C 3
+
+int foo(int x) { return ~(x ^ C) == (x ^ ~C); }
+
+/*
+ * check-name: simplify-not-xor-cte
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$1
+ */