[LLVMbugs] [Bug 9662] New: C backend invokes Fortran's CPU_TIME with incorrect number of parameters

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 8 12:02:37 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9662

           Summary: C backend invokes Fortran's CPU_TIME with incorrect
                    number of parameters
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: maemarcus at gmail.com
                CC: llvmbugs at cs.uiuc.edu


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?

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list