hooking a new intrinsic subroutine?
Paul Brook
paul@codesourcery.com
Sun Apr 18 20:26:00 GMT 2004
On Sunday 18 April 2004 20:26, Steve Kargl wrote:
> > System_clock should already work properly (actually it's &rate, bit I
> > assume that's a typo). Use -fdump-tree-original to see exactly what is
> > being generated.
>
> kargl[205] gfortran -static system_clock.f90
> /var/tmp/cch50HhN.o: In function `MAIN__':
> /var/tmp/cch50HhN.o(.text+0x16): undefined reference to
> `_gfortran_system_clock' /var/tmp/cch50HhN.o(.text+0x15c): undefined
> reference to `_gfortran_system_clock' /var/tmp/cch50HhN.o(.text+0x24b):
> undefined reference to `_gfortran_system_clock' collect2: ld returned 1
> exit status
Ah, I menant the compiler side, not the library side!
> > The problems is in the generation of the backent trees, although we may
> > require extra information from type resolution.
> >
> > The erroneous case is date_and time. Take for example
> > call date_and_time(time=t)
> > We currently generate
> > _gfortran_date_and_time(NULL, &t, NULL, NULL, 10)
> > We should generate
> > _gfortran_date_and_time(NULL, &t, NULL, NULL, 0, 10, 0)
> >
> > The code that deals with this is around line 1038 in trans-expr.c
> > (gfc_conv_function_call). We don't have a formal argument lists for
> > intrinsic subroutines, so we don't know to pass the absent string length.
> >
> > The problem is fairly straightforward, I just haven't figured out the
> > solution :)
>
> Aren't the NULL's sufficient to imply a 0 length?
A procedures always have a fixed number and type of arguments at the ABI
level, so we still need to pass the character lengths. The actual value
passed is unimportant. In the above example we need to pass
date_and_time (<absent>(len=<ignored>), time(len=t), <absent>(len=<ignored>))
We currently pass
date_and_time (<absent>(len=10), time(len=<garbage>), time(len=<garbage>))
Paul
More information about the Fortran
mailing list