@@ -589,15 +589,20 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
589589 } ,
590590 ( _, "volatile_store" ) => {
591591 let tp_ty = * substs. types . get ( FnSpace , 0 ) ;
592- let val = if fn_ty. args [ 1 ] . is_indirect ( ) {
593- Load ( bcx, llargs[ 1 ] )
592+ if type_is_fat_ptr ( bcx. tcx ( ) , tp_ty) {
593+ VolatileStore ( bcx, llargs[ 1 ] , expr:: get_dataptr ( bcx, llargs[ 0 ] ) ) ;
594+ VolatileStore ( bcx, llargs[ 2 ] , expr:: get_meta ( bcx, llargs[ 0 ] ) ) ;
594595 } else {
595- from_immediate ( bcx, llargs[ 1 ] )
596- } ;
597- let ptr = PointerCast ( bcx, llargs[ 0 ] , val_ty ( val) . ptr_to ( ) ) ;
598- let store = VolatileStore ( bcx, val, ptr) ;
599- unsafe {
600- llvm:: LLVMSetAlignment ( store, type_of:: align_of ( ccx, tp_ty) ) ;
596+ let val = if fn_ty. args [ 1 ] . is_indirect ( ) {
597+ Load ( bcx, llargs[ 1 ] )
598+ } else {
599+ from_immediate ( bcx, llargs[ 1 ] )
600+ } ;
601+ let ptr = PointerCast ( bcx, llargs[ 0 ] , val_ty ( val) . ptr_to ( ) ) ;
602+ let store = VolatileStore ( bcx, val, ptr) ;
603+ unsafe {
604+ llvm:: LLVMSetAlignment ( store, type_of:: align_of ( ccx, tp_ty) ) ;
605+ }
601606 }
602607 C_nil ( ccx)
603608 } ,
0 commit comments