From 82fb9aa41847d08556cfe12cc51a54a3ca2e2536 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 20 Mar 2021 00:55:55 +0100 Subject: [PATCH] testcase related to pr #1423 --- test/val/pr1423.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/val/pr1423.c diff --git a/test/val/pr1423.c b/test/val/pr1423.c new file mode 100644 index 000000000..3135b64a3 --- /dev/null +++ b/test/val/pr1423.c @@ -0,0 +1,41 @@ +/* pr #1423 - Codegen fix for certain cases of object addresses as boolean */ + +unsigned char fails = 0; + +void test1(void) +{ + int a; + while (&a) { + return; + } + fails++; + return; +} + +void test2(void) +{ + int a; + do { + return; + } while (&a); + fails++; + return; +} + +void test3(void) +{ + int a; + for (;&a;) { + return; + } + fails++; + return; +} + +int main(void) +{ + test1(); + test2(); + test3(); + return fails; +}