aboutsummaryrefslogtreecommitdiff
path: root/tests/lvalue-conversion.qbe
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-02-19 12:43:29 -0800
committerMichael Forney <mforney@mforney.org>2019-02-19 13:25:27 -0800
commit07ead54177dbbc28ce0665f0091f6be0940f5763 (patch)
treeab5c47e87a85c9ed05fb39006f0c9ae59eec7ef2 /tests/lvalue-conversion.qbe
parentd13019290ee2e7f41369f1d31ce903efd26cfd05 (diff)
Add missing lvalue conversions
typeintpromote and typeargpromote assume they are dealing with an unqualified type, and return an incorrect result if they are given a qualified one. So, add an assert here. This was causing const integer types to get promoted to themselves due to missing lvalue conversions. Thanks to Andrew Chambers for the bug report and test case.
Diffstat (limited to 'tests/lvalue-conversion.qbe')
-rw-r--r--tests/lvalue-conversion.qbe14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/lvalue-conversion.qbe b/tests/lvalue-conversion.qbe
new file mode 100644
index 0000000..ac5fbc3
--- /dev/null
+++ b/tests/lvalue-conversion.qbe
@@ -0,0 +1,14 @@
+data $.Lc.2 = align 1 { b 0, }
+export
+function $f() {
+@start.1
+@body.2
+ %.1 =w loadub $.Lc.2
+ %.2 =w extub %.1
+ call $g(w %.2)
+ %.3 =w loadub $.Lc.2
+ %.4 =w extub %.3
+ %.5 =w xor %.4, 18446744073709551615
+ call $g(w %.5)
+ ret
+}