summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-02-19 09:55:45 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-02-19 09:55:45 +0000
commit3ec022950ec233a2af418aacd1755fce4d701724 (patch)
tree154256c5c73fda06e874fb05695e14e610ba8ad4 /test
parent9aeba45962e8ba5cde5d81fb701a4c9a3963f4a5 (diff)
Add option -Os to optimize for code size rather than for execution speed.
Refactored compilation flags that affect the Coq part (module Compopts). Added support for C99 for loops with declarations. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2410 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test')
-rw-r--r--test/regression/Makefile2
-rw-r--r--test/regression/Results/for115
-rw-r--r--test/regression/for1.c20
3 files changed, 36 insertions, 1 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile
index c653a01..4d9683c 100644
--- a/test/regression/Makefile
+++ b/test/regression/Makefile
@@ -11,7 +11,7 @@ LIBS=$(LIBMATH)
TESTS=int32 int64 floats floats-basics \
expr1 expr6 funptr2 initializers volatile1 volatile2 volatile3 \
funct3 expr5 struct7 struct8 struct11 casts1 casts2 char1 \
- sizeof1 sizeof2 binops bool
+ sizeof1 sizeof2 binops bool for1
# Can run, but only in compiled mode, and have reference output in Results
diff --git a/test/regression/Results/for1 b/test/regression/Results/for1
new file mode 100644
index 0000000..72ef7e0
--- /dev/null
+++ b/test/regression/Results/for1
@@ -0,0 +1,15 @@
+loop1: 0
+loop1: 1
+loop1: 2
+loop2: 0
+loop2: 1
+loop2: 2
+old i = 3
+loop3: 0 1
+loop3: 1 3
+loop3: 2 5
+old i = 3
+loop4: 0 4
+loop4: 1 3
+loop4: 2 2
+old i = 3
diff --git a/test/regression/for1.c b/test/regression/for1.c
new file mode 100644
index 0000000..4563dde
--- /dev/null
+++ b/test/regression/for1.c
@@ -0,0 +1,20 @@
+/* C99 'for' loops with declarations */
+
+#include <stdio.h>
+
+int main()
+{
+ int i;
+ for (i = 0; i < 3; i++) printf("loop1: %d\n", i);
+ for (int i = 0; i < 3; i++) printf("loop2: %d\n", i);
+ printf("old i = %d\n", i);
+ for (int i = 0, j; i < 3; i++) {
+ j = i * 2 + 1; printf("loop3: %d %d\n", i, j);
+ }
+ printf("old i = %d\n", i);
+ for (int i = 0, j = i + 4; i < 3; i++, j--) {
+ printf("loop4: %d %d\n", i, j);
+ }
+ printf("old i = %d\n", i);
+ return 0;
+}