From 68c5da90234d8956dac083c5f9fd1cae96a7317c Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sun, 1 Jun 2008 14:28:35 +0000 Subject: [PATCH] testcase for sideeffects problems [r19905] --- parsetest/implicit.c | 3 ++- parsetest/sideeffects.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 parsetest/sideeffects.c diff --git a/parsetest/implicit.c b/parsetest/implicit.c index 88af067..85d3500 100644 --- a/parsetest/implicit.c +++ b/parsetest/implicit.c @@ -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 index 0000000..32b905b --- /dev/null +++ b/parsetest/sideeffects.c @@ -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; +} -- 2.20.1