diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2011-08-18 14:50:19 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2011-08-18 14:50:19 +0000 |
commit | 50ee6bdf639ffba989968abb9c24a57126ab35a4 (patch) | |
tree | 80e123d295a84372b13739b6905d583fa9bbe700 /test/regression/volatile3.c | |
parent | 62a07ee96d51c29bab9668d8c41bf5f8bdf9e23d (diff) | |
download | compcert-50ee6bdf639ffba989968abb9c24a57126ab35a4.tar.gz compcert-50ee6bdf639ffba989968abb9c24a57126ab35a4.zip |
Presimplification SimplVolatile: cleaned up and integrated.
test/*/Makefile: normalized 'bench' target
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1717 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/regression/volatile3.c')
-rw-r--r-- | test/regression/volatile3.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/test/regression/volatile3.c b/test/regression/volatile3.c new file mode 100644 index 00000000..2999609a --- /dev/null +++ b/test/regression/volatile3.c @@ -0,0 +1,77 @@ +/* Expansion of read-modify-write operations on volatiles */ + +#include <stdio.h> + +volatile int x; +volatile unsigned char c; + +int main() +{ + x = 0; + printf("x = %d\n", x); + + x++; + printf("x = %d\n", x); + printf ("x++ = %d\n", x++); + printf("x = %d\n", x); + + x += 42; + printf("x = %d\n", x); + printf ("x += 12 = %d\n", x += 12); + printf("x = %d\n", x); + + x--; + printf("x = %d\n", x); + printf ("x-- = %d\n", x--); + printf("x = %d\n", x); + + x -= 7; + printf("x = %d\n", x); + printf ("x -= 3 = %d\n", x -= 3); + printf("x = %d\n", x); + + ++x; + printf("x = %d\n", x); + printf ("++x = %d\n", ++x); + printf("x = %d\n", x); + + --x; + printf("x = %d\n", x); + printf ("--x = %d\n", --x); + printf("x = %d\n", x); + + c = 0; + printf("c = %d\n", c); + + c++; + printf("c = %d\n", c); + printf ("c++ = %d\n", c++); + printf("c = %d\n", c); + + c += 250; + printf("c = %d\n", c); + printf ("c += 42 = %d\n", c += 42); + printf("c = %d\n", c); + + c--; + printf("c = %d\n", c); + printf ("c-- = %d\n", c--); + printf("c = %d\n", c); + + c -= 7; + printf("c = %d\n", c); + printf ("c -= 3 = %d\n", c -= 3); + printf("c = %d\n", c); + + ++c; + printf("c = %d\n", c); + printf ("++c = %d\n", ++c); + printf("c = %d\n", c); + + --c; + printf("c = %d\n", c); + printf ("--c = %d\n", --c); + printf("c = %d\n", c); + + return 0; +} |