From f53bf21c6ad9fb3d2f1a40e2ce06816a6b2e3106 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 6 Dec 2011 16:56:06 +0000 Subject: Add tests for memory address handling, fix compiler for negative constant --- tests/params.c | 7 +++++++ tests/read-timer.c | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/read-timer.c (limited to 'tests') diff --git a/tests/params.c b/tests/params.c index 2232fdd..2073000 100644 --- a/tests/params.c +++ b/tests/params.c @@ -3,9 +3,16 @@ int square(int x) { res = x * x; return res; } +int div(int a, int b) { + int aa = -a; + int bb = 1 * b; + return aa / bb; +} int main() { int x; x = square(9);// 81 e:goto e; + x = div(-150, 10);// 15 + ef:goto ef; return x; } diff --git a/tests/read-timer.c b/tests/read-timer.c new file mode 100644 index 0000000..d7bb2c3 --- /dev/null +++ b/tests/read-timer.c @@ -0,0 +1,6 @@ +int timer; +int *timerp = (int*)-3; +void main() { + timer = *timerp; + g:goto g; +} -- cgit v1.2.1