aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cast-same-type.c4
-rw-r--r--test/cast-same-type.qbe12
2 files changed, 16 insertions, 0 deletions
diff --git a/test/cast-same-type.c b/test/cast-same-type.c
new file mode 100644
index 0000000..5602057
--- /dev/null
+++ b/test/cast-same-type.c
@@ -0,0 +1,4 @@
+struct S {int x;} s;
+int main(void) {
+ return ((struct S)s).x;
+}
diff --git a/test/cast-same-type.qbe b/test/cast-same-type.qbe
new file mode 100644
index 0000000..625f937
--- /dev/null
+++ b/test/cast-same-type.qbe
@@ -0,0 +1,12 @@
+export
+function w $main() {
+@start.1
+@body.2
+ %.1 =l copy $s
+ %.2 =l mul 0, 1
+ %.3 =l add %.1, %.2
+ %.4 =l copy %.3
+ %.5 =w loadsw %.4
+ ret %.5
+}
+export data $s = align 4 { z 4 }