aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/conditional-compound-literal.c4
-rw-r--r--test/conditional-compound-literal.qbe25
2 files changed, 29 insertions, 0 deletions
diff --git a/test/conditional-compound-literal.c b/test/conditional-compound-literal.c
new file mode 100644
index 0000000..33a5416
--- /dev/null
+++ b/test/conditional-compound-literal.c
@@ -0,0 +1,4 @@
+int main(void) {
+ int x = 0, *p = 0 ? 0 : &(int){x};
+ return *p;
+}
diff --git a/test/conditional-compound-literal.qbe b/test/conditional-compound-literal.qbe
new file mode 100644
index 0000000..9e9c5f7
--- /dev/null
+++ b/test/conditional-compound-literal.qbe
@@ -0,0 +1,25 @@
+export
+function w $main() {
+@start.1
+ %.1 =l alloc4 4
+ %.3 =l alloc8 8
+ %.6 =l alloc4 4
+@body.2
+ %.2 =l add %.1, 0
+ storew 0, %.2
+ %.4 =l add %.3, 0
+ %.5 =w cnew 0, 0
+ jnz %.5, @cond_true.3, @cond_false.4
+@cond_true.3
+ jmp @cond_join.5
+@cond_false.4
+ %.7 =l add %.6, 0
+ %.8 =w loadsw %.1
+ storew %.8, %.7
+@cond_join.5
+ %.9 =l phi @cond_true.3 0, @cond_false.4 %.6
+ storel %.9, %.4
+ %.10 =l loadl %.3
+ %.11 =w loadsw %.10
+ ret %.11
+}