aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2018-01-13 12:07:38 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2018-01-13 12:07:38 +0100
commit2966858f83db9d31efd2dce270bc9e3b36708dd9 (patch)
treeeb91fb8c9adb0bfd599d3cefd7b3d672a2f6e89f
parent03538a45fb7db3520c7d462c3192076918ad7b90 (diff)
downloadcompcert-kvx-2966858f83db9d31efd2dce270bc9e3b36708dd9.tar.gz
compcert-kvx-2966858f83db9d31efd2dce270bc9e3b36708dd9.zip
Add regression test for issue #211
-rw-r--r--test/regression/Makefile3
-rw-r--r--test/regression/Results/for21
-rw-r--r--test/regression/for2.c14
3 files changed, 17 insertions, 1 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile
index 42b6b247..48e2b7b3 100644
--- a/test/regression/Makefile
+++ b/test/regression/Makefile
@@ -12,9 +12,10 @@ TESTS=int32 int64 floats floats-basics \
expr1 expr6 funptr2 initializers initializers2 initializers3 \
volatile1 volatile2 volatile3 volatile4 \
funct3 expr5 struct7 struct8 struct11 struct12 casts1 casts2 char1 \
- sizeof1 sizeof2 binops bool for1 switch switch2 compound \
+ sizeof1 sizeof2 binops bool for1 for2 switch switch2 compound \
decl1 interop1 bitfields9 ptrs3 \
parsing krfun
+
# Can run, but only in compiled mode, and have reference output in Results
TESTS_COMP=attribs1 bitfields1 bitfields2 bitfields3 bitfields4 \
diff --git a/test/regression/Results/for2 b/test/regression/Results/for2
new file mode 100644
index 00000000..1c0bbbe3
--- /dev/null
+++ b/test/regression/Results/for2
@@ -0,0 +1 @@
+Value of 'press' should be 100, is: 100
diff --git a/test/regression/for2.c b/test/regression/for2.c
new file mode 100644
index 00000000..ed43a08d
--- /dev/null
+++ b/test/regression/for2.c
@@ -0,0 +1,14 @@
+/* Issue #211 */
+
+#include <stdio.h>
+
+int press = 100;
+int valve = 0;
+
+int main (void) {
+ for (int press = 0; press < 3; press++) {
+ valve++;
+ }
+ printf ("Value of 'press' should be 100, is: %d\n", press);
+ return valve - 3;
+}