aboutsummaryrefslogtreecommitdiffhomepage
path: root/test.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-05-30 18:20:21 +0200
committerlemon <lsof@mailbox.org>2023-05-31 08:27:39 +0200
commit05c305bee19221e3b5b9557267c5cfa7525f752f (patch)
treee815dc1c9bce65c3c162146df9cba2d265766ec2 /test.c
parent43566b21908d80b7c4448c1547c520e3e7c155af (diff)
fix void conditional expr; condjump, condexprvalue optimizations
Diffstat (limited to 'test.c')
-rw-r--r--test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test.c b/test.c
index 461d42f..e16e415 100644
--- a/test.c
+++ b/test.c
@@ -17,4 +17,19 @@ int test0(struct foo *foo) { return foo->x ? foo->y : foo->z; }
int test1(int x, int y, int z) { return x && y || z; }
int test2(int x, int y, int z) { return x || y && z; }
+extern void f();
+int test3(int x, int y) {
+ if (x < 0 && y < 0 && 1) return x - y;
+ if ((x == 0 || x > 0) && y > 0) return y;
+ if (f(), x == y ? x && 1 : 0 || y) return x;
+ return x + y;
+}
+
+int test4(int c) {
+ return c == 'a' || c == 'x' ? 1
+ : (f(), c == 'b' || c == 'y') ? 2
+ : c == 'c' || c == 'z' ? 3
+ : 0;
+}
+
//