[LLVMdev] gfortran calling convention

Michael McCracken michael.mccracken at gmail.com
Fri Sep 1 19:52:07 PDT 2006


The NIST F77 test suite doesn't seem to be compatible with gfortran at
all, so I had to work from my own sample codes, and generate test
cases from them.

Here's what works now, and I have a separate test case for each of these:

statement functions
intrinsic functions (print, cos, etc)
loops, goto statments
scalarized array operations
function calls with *no arguments*
simple common blocks

Function calls with more than one argument don't work. Specifically:

..../gfortran funccall-1arg.f -o funccall-1arg.exe
..../llvm/lib/VMCore/Instructions.cpp:209: failed assertion
`(Params.size() == FTy->getNumParams() || (FTy->isVarArg() &&
Params.size() > FTy->getNumParams())) && "Calling a function with bad
signature!"'
funccall-1arg.f: In function 'MAIN__':
funccall-1arg.f:5: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://llvm.org/bugs> for instructions.
make: *** [funccall-1arg.exe] Error 1

While I didn't entirely understand the cause from the backtraces and
inspection in the debugger, I did notice that there is not yet a
calling convention in CallingConv.h for Fortran, and llvm-convert only
tests for CallingConv:C and CSRet, so I suspect that the different CCs
is a problem here.

It looks like I will have to implement a complement to the
FunctionCallArgumentConversion class in llvm-convert.c for the Fortran
CC, but I'm not clear on the role of the CallingConv ID enum. Does a
Fortran CC belong in there, or is that only for the back end?

Thanks,
-mike
-- 
Michael McCracken
UCSD CSE PhD Candidate
research: http://www.cse.ucsd.edu/~mmccrack/
misc: http://michael-mccracken.net/wp/



More information about the llvm-dev mailing list