File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -676,17 +676,23 @@ static jl_cgval_t generic_cast(
676676    Type *to = bitstype_to_llvm ((jl_value_t *)jlto, ctx.builder .getContext (), true );
677677    Type *vt = bitstype_to_llvm (v.typ , ctx.builder .getContext (), true );
678678
679-     //  fptrunc fpext depend on the specific floating point format to work 
680-     //  correctly, and so do not pun their argument types.
679+     //  fptrunc and  fpext depend on the specific floating point
680+     //  format to work  correctly, and so do not pun their argument types.
681681    if  (!(f == fpext || f == fptrunc)) {
682-         if  (toint)
683-             to = INTT (to, DL);
684-         else 
685-             to = FLOATT (to);
686-         if  (fromint)
687-             vt = INTT (vt, DL);
688-         else 
689-             vt = FLOATT (vt);
682+         //  uitofp/sitofp require a specific float type argument
683+         if  (!(f == uitofp || f == sitofp)){
684+             if  (toint)
685+                 to = INTT (to, DL);
686+             else 
687+                 to = FLOATT (to);
688+         }
689+         //  fptoui/fptosi require a specific float value argument
690+         if  (!(f == fptoui || f == fptosi)) {
691+             if  (fromint)
692+                 vt = INTT (vt, DL);
693+             else 
694+                 vt = FLOATT (vt);
695+         }
690696    }
691697
692698    if  (!to || !vt)
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments