diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2011-11-26 15:27:12 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2011-11-26 15:27:12 +0000 |
commit | 015c64c64a5a547dcef81a75a589eeaf034654cd (patch) | |
tree | c1eb0fde67fcc867e825c71a26bd9e298056e634 /test/regression/volatile1.c | |
parent | 3d8ebc77e801c81cd733cf42dde2153adc3f9037 (diff) | |
download | compcert-015c64c64a5a547dcef81a75a589eeaf034654cd.tar.gz compcert-015c64c64a5a547dcef81a75a589eeaf034654cd.zip |
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/regression/volatile1.c')
-rw-r--r-- | test/regression/volatile1.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/regression/volatile1.c b/test/regression/volatile1.c index 850bbeda..10a7abea 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; +} |