summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-11-26 15:27:12 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-11-26 15:27:12 +0000
commit015c64c64a5a547dcef81a75a589eeaf034654cd (patch)
treec1eb0fde67fcc867e825c71a26bd9e298056e634 /test
parent3d8ebc77e801c81cd733cf42dde2153adc3f9037 (diff)
Fixed serious bug in handling of volatile arrays.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1737 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test')
-rw-r--r--test/regression/Makefile4
-rw-r--r--test/regression/Results/volatile14
-rw-r--r--test/regression/volatile1.c18
3 files changed, 24 insertions, 2 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile
index aeba3bd..103901e 100644
--- a/test/regression/Makefile
+++ b/test/regression/Makefile
@@ -9,14 +9,14 @@ LIBS=$(LIBMATH)
TESTS=attribs1 bitfields1 bitfields2 bitfields3 bitfields4 \
bitfields5 bitfields6 bitfields7 \
- expr1 expr6 initializers volatile2 volatile3 \
+ expr1 expr6 initializers volatile1 volatile2 volatile3 \
funct3 expr5 struct7 struct8 struct11 casts1 casts2 char1 \
sizeof1 sizeof2 packedstruct1
# Other tests: should compile to .s without errors (but expect warnings)
EXTRAS=annot1 commaprec expr2 expr3 expr4 extern1 funct2 funptr1 init1 \
init2 init3 init4 pragmas ptrs1 ptrs2 struct1 struct2 struct3 \
- struct4 struct5 struct6 struct9 struct10 types1 volatile1
+ struct4 struct5 struct6 struct9 struct10 types1
# Test known to fail
FAILURES=funct1 varargs1
diff --git a/test/regression/Results/volatile1 b/test/regression/Results/volatile1
new file mode 100644
index 0000000..2be2eb2
--- /dev/null
+++ b/test/regression/Results/volatile1
@@ -0,0 +1,4 @@
+f1() = 123
+v = 42
+f3() = 44
+f5(2) = 2
diff --git a/test/regression/volatile1.c b/test/regression/volatile1.c
index 850bbed..10a7abe 100644
--- a/test/regression/volatile1.c
+++ b/test/regression/volatile1.c
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
volatile int v;
int f1(void) { return v; }
@@ -7,3 +9,19 @@ void f2(void) { v = 42; }
int f3(void) { return v / v + 1 + v; }
void f4(void) { v; }
+
+volatile int t[2];
+
+int f5(int x) { t[0] = x; return t[0]; }
+
+int main()
+{
+ v = 123;
+ printf("f1() = %d\n", f1());
+ f2();
+ printf("v = %d\n", v);
+ printf("f3() = %d\n", f3());
+ f4();
+ printf("f5(2) = %d\n", f5(2));
+ return 0;
+}