-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
| Bugzilla Link | 9662 |
| Resolution | DUPLICATE |
| Resolved on | Apr 09, 2011 00:44 |
| Version | trunk |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
Extended Description
The incorrect invocation of Fortran external routines in C backend seems to be effective for some builtin functions as well. The following example:
program test
real :: val
call cpu_time(val)
val = sin(val)
print *, val
end
converts to:
static void MAIN__(int vararg_dummy_arg,...) {
float llvm_cbe_memtmp; /* Address-exposed local /
struct l_struct_OC___st_parameter_dt llvm_cbe_memtmp1; / Address-exposed local */
unsigned int llvm_cbe_alloca_20_point;
unsigned int llvm_cbe_ssa_20_point;
float llvm_cbe_tmp__1;
float llvm_cbe_tmp__2;
unsigned int llvm_cbe_tmp__3;
llvm_cbe_alloca_20_point = ((unsigned int )0u);
llvm_cbe_ssa_20_point = ((unsigned int )0u);
_gfortran_cpu_time_4(0 /dummy arg/, (&llvm_cbe_memtmp));
llvm_cbe_tmp__1 = *(&llvm_cbe_memtmp);
llvm_cbe_tmp__2 = sinf(llvm_cbe_tmp__1);
*(&llvm_cbe_memtmp) = llvm_cbe_tmp__2;
*((&((&llvm_cbe_memtmp1.field0))->field2)) = ((&_OC_cst.array[((signed long long )0ull)]));
*((&((&llvm_cbe_memtmp1.field0))->field3)) = 5u;
*((&((&llvm_cbe_memtmp1.field0))->field0)) = 128u;
*((&((&llvm_cbe_memtmp1.field0))->field1)) = 6u;
_gfortran_st_write((&llvm_cbe_memtmp1));
_gfortran_transfer_real((&llvm_cbe_memtmp1), (((unsigned char *)(&llvm_cbe_memtmp))), 4u);
llvm_cbe_tmp__3 = _gfortran_st_write_done((&llvm_cbe_memtmp1));
return;
}
Here sinf is invoked correctly, while _gfortran_cpu_time_4 with additional dummy param causes a segmentation fault.
How backend determines if function call needs a dummy arg in this case?