about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2018-11-20 12:14:53 +0100
committerOlivier Goffart <ogoffart@woboq.com>2018-11-20 12:20:05 +0100
commit86d41350c790502d3a1227bab3433ac7472ccb4c (patch)
treefc9cdeb68f765fcf6ff051dcab7a925eddf17893 /src/test/codegen
parent046e054a995c7b293e26968774ff88b38661cd3c (diff)
downloadrust-86d41350c790502d3a1227bab3433ac7472ccb4c.tar.gz
rust-86d41350c790502d3a1227bab3433ac7472ccb4c.zip
Fix invalid bitcast taking bool out of a union represented as a scalar
As reported in https://github.com/rust-lang/rust/pull/54668#issuecomment-440186476
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/union-abi.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/codegen/union-abi.rs b/src/test/codegen/union-abi.rs
index 786968128ec..5a6df52502e 100644
--- a/src/test/codegen/union-abi.rs
+++ b/src/test/codegen/union-abi.rs
@@ -78,3 +78,9 @@ pub union CUnionU128{a:u128}
 #[no_mangle]
 pub fn test_CUnionU128(_: CUnionU128) { loop {} }
 
+pub union UnionBool { b:bool }
+// CHECK: define zeroext i1 @test_UnionBool(i8 %b)
+#[no_mangle]
+pub fn test_UnionBool(b: UnionBool) -> bool { unsafe { b.b }  }
+// CHECK: %0 = trunc i8 %b to i1
+