From 86d41350c790502d3a1227bab3433ac7472ccb4c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 20 Nov 2018 12:14:53 +0100 Subject: 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 --- src/test/codegen/union-abi.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/test/codegen') 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 + -- cgit 1.4.1-3-g733a5