aboutsummaryrefslogtreecommitdiff
path: root/test/kr-function-argument-promotion.qbe
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-07-05 23:19:34 -0700
committerMichael Forney <mforney@mforney.org>2019-07-05 23:32:44 -0700
commit114623a84c8165d7bf2acc4ac1e912c2f69e2a7c (patch)
treefadc72ca21806a20d075a0855a416d6144093ae9 /test/kr-function-argument-promotion.qbe
parent31a928c187847238e84f8b02a73e70b256840108 (diff)
qbe: Handle K&R function definition argument promotion
Parameters for K&R function definitions that are affected by default argument promotion are passed as their promoted type, so need to be converted back before storing into memory allocated for the parameter.
Diffstat (limited to 'test/kr-function-argument-promotion.qbe')
-rw-r--r--test/kr-function-argument-promotion.qbe18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/kr-function-argument-promotion.qbe b/test/kr-function-argument-promotion.qbe
new file mode 100644
index 0000000..6d2f2b8
--- /dev/null
+++ b/test/kr-function-argument-promotion.qbe
@@ -0,0 +1,18 @@
+export
+function w $f(w %.1) {
+@start.1
+ %.2 =w extub %.1
+ %.3 =l alloc4 1
+ storeb %.2, %.3
+@body.2
+ %.4 =w loadub %.3
+ %.5 =w extub %.4
+ ret %.5
+}
+export
+function w $main() {
+@start.3
+@body.4
+ %.1 =w call $f(w 256)
+ ret %.1
+}