testcase for sideeffects problems
authorMatthias Braun <matze@braunis.de>
Sun, 1 Jun 2008 14:28:35 +0000 (14:28 +0000)
committerMatthias Braun <matze@braunis.de>
Sun, 1 Jun 2008 14:28:35 +0000 (14:28 +0000)
[r19905]

parsetest/implicit.c
parsetest/sideeffects.c [new file with mode: 0644]

index 88af067..85d3500 100644 (file)
@@ -3,7 +3,8 @@ void test1() {
 }
 
 void test2() {
-       for(int i = rand(); i < 20; ++i)
+       int i;
+       for(i = rand(); i < 20; ++i)
                break;
 }
 
diff --git a/parsetest/sideeffects.c b/parsetest/sideeffects.c
new file mode 100644 (file)
index 0000000..32b905b
--- /dev/null
@@ -0,0 +1,19 @@
+int puts(const char *str);
+
+int arr[100];
+
+int main(void) {
+       arr[puts("hello1")] += 5;
+       arr[puts("hello2")] -= 5;
+       arr[puts("hello3")] *= 5;
+       arr[puts("hello4")] /= 5;
+       arr[puts("hello5")] %= 5;
+       arr[puts("hello6")] &= 5;
+       arr[puts("hello7")] |= 5;
+       arr[puts("hello8")] ^= 5;
+       arr[puts("hello9")]++;
+       arr[puts("hello10")]--;
+       ++arr[puts("hello11")];
+       --arr[puts("hello12")];
+       return 0;
+}