@@ -4,7 +4,9 @@ mod simd;
44#[ cfg( feature="master" ) ]
55use std:: iter;
66
7- use gccjit:: { ComparisonOp , Function , RValue , ToRValue , Type , UnaryOp , FunctionType } ;
7+ #[ cfg( feature="master" ) ]
8+ use gccjit:: FunctionType ;
9+ use gccjit:: { ComparisonOp , Function , RValue , ToRValue , Type , UnaryOp } ;
810use rustc_codegen_ssa:: MemFlags ;
911use rustc_codegen_ssa:: base:: wants_msvc_seh;
1012use rustc_codegen_ssa:: common:: IntPredicate ;
@@ -143,11 +145,15 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
143145
144146 sym:: volatile_load | sym:: unaligned_volatile_load => {
145147 let tp_ty = fn_args. type_at ( 0 ) ;
146- let mut ptr = args[ 0 ] . immediate ( ) ;
147- if let PassMode :: Cast { cast : ty, .. } = & fn_abi. ret . mode {
148- ptr = self . pointercast ( ptr, self . type_ptr_to ( ty. gcc_type ( self ) ) ) ;
149- }
150- let load = self . volatile_load ( ptr. get_type ( ) , ptr) ;
148+ let ptr = args[ 0 ] . immediate ( ) ;
149+ let load =
150+ if let PassMode :: Cast { cast : ty, pad_i32 : _ } = & fn_abi. ret . mode {
151+ let gcc_ty = ty. gcc_type ( self ) ;
152+ self . volatile_load ( gcc_ty, ptr)
153+ }
154+ else {
155+ self . volatile_load ( self . layout_of ( tp_ty) . gcc_type ( self ) , ptr)
156+ } ;
151157 // TODO(antoyo): set alignment.
152158 self . to_immediate ( load, self . layout_of ( tp_ty) )
153159 }
0 commit comments