From 0ac22f0214ee283ce9bb053d691aeac823f875be Mon Sep 17 00:00:00 2001 From: Teddy Date: Wed, 7 May 2014 03:07:34 +0800 Subject: add opt checking testcases --- testbed/custom_const.c | 9 +++++++++ testbed/custom_opt.c | 9 --------- testbed/custom_subexp.c | 9 +++++++++ testbed/custom_subexp2.c | 10 ++++++++++ 4 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 testbed/custom_const.c delete mode 100644 testbed/custom_opt.c create mode 100644 testbed/custom_subexp.c create mode 100644 testbed/custom_subexp2.c diff --git a/testbed/custom_const.c b/testbed/custom_const.c new file mode 100644 index 0000000..d0126f3 --- /dev/null +++ b/testbed/custom_const.c @@ -0,0 +1,9 @@ +int sum; +void f() { + sum = 3; +} +int main() { + sum = 1; + f(); + printf("%d\n", sum); +} diff --git a/testbed/custom_opt.c b/testbed/custom_opt.c deleted file mode 100644 index d0126f3..0000000 --- a/testbed/custom_opt.c +++ /dev/null @@ -1,9 +0,0 @@ -int sum; -void f() { - sum = 3; -} -int main() { - sum = 1; - f(); - printf("%d\n", sum); -} diff --git a/testbed/custom_subexp.c b/testbed/custom_subexp.c new file mode 100644 index 0000000..bce5bdb --- /dev/null +++ b/testbed/custom_subexp.c @@ -0,0 +1,9 @@ +int N = 0; +void f() { N = 2; } +int main() { + int a, b; + a = N + 1; + f(); + b = N + 1; + printf("%d\n", b); +} diff --git a/testbed/custom_subexp2.c b/testbed/custom_subexp2.c new file mode 100644 index 0000000..1e4af93 --- /dev/null +++ b/testbed/custom_subexp2.c @@ -0,0 +1,10 @@ +int flag = 0; +int check(int x, int y) { + return x > 0 && y > 0 && (flag ^= 1); +} +int main() { + int x = 1, y = 2; + printf("%d\n", check(x, y)); + printf("%d\n", check(x, y)); + printf("%d\n", check(x, y)); +} -- cgit v1.2.3