diff options
Diffstat (limited to 'test/regression')
-rw-r--r-- | test/regression/Makefile | 6 | ||||
-rw-r--r-- | test/regression/Results/volatile3 | 38 | ||||
-rw-r--r-- | test/regression/volatile3.c | 77 |
3 files changed, 118 insertions, 3 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile index eb50defc..aeba3bd3 100644 --- a/test/regression/Makefile +++ b/test/regression/Makefile @@ -1,8 +1,7 @@ include ../../Makefile.config CCOMP=../../ccomp -CCOMPFLAGS=-stdlib ../../runtime -dparse -dc -dclight -dasm \ - -fstruct-passing -fstruct-assign -fbitfields -fpacked-structs +CCOMPFLAGS=-stdlib ../../runtime -dparse -dc -dclight -dasm -fall LIBS=$(LIBMATH) @@ -10,7 +9,7 @@ LIBS=$(LIBMATH) TESTS=attribs1 bitfields1 bitfields2 bitfields3 bitfields4 \ bitfields5 bitfields6 bitfields7 \ - expr1 expr6 initializers volatile2 \ + expr1 expr6 initializers volatile2 volatile3 \ funct3 expr5 struct7 struct8 struct11 casts1 casts2 char1 \ sizeof1 sizeof2 packedstruct1 @@ -44,3 +43,4 @@ test: fi; \ done +bench: diff --git a/test/regression/Results/volatile3 b/test/regression/Results/volatile3 new file mode 100644 index 00000000..3d1f786b --- /dev/null +++ b/test/regression/Results/volatile3 @@ -0,0 +1,38 @@ +x = 0 +x = 1 +x++ = 1 +x = 2 +x = 44 +x += 12 = 56 +x = 56 +x = 55 +x-- = 55 +x = 54 +x = 47 +x -= 3 = 44 +x = 44 +x = 45 +++x = 46 +x = 46 +x = 45 +--x = 44 +x = 44 +c = 0 +c = 1 +c++ = 1 +c = 2 +c = 252 +c += 42 = 38 +c = 38 +c = 37 +c-- = 37 +c = 36 +c = 29 +c -= 3 = 26 +c = 26 +c = 27 +++c = 28 +c = 28 +c = 27 +--c = 26 +c = 26 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; +} |