This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Ada] new Ada2005 units


Hi Arnaud, I see you are linking with the fortran BLAS and LAPACK
libraries.  Did you solve [9723-001], which was reduced from a
binding to the BLAS?  The following example illustrates the problem,
which unsolved leads to mysterious crashes:

      subroutine f_proc
     &   ( x )
      character  x
      end

f2c turns this into:

int f_proc__(char *x, ftnlen x_len)
{
    return 0;
}

Note the extra parameter x_len.

Based on the tree dumps, gfortran also seems to add an extra parameter.

However a fairly recent GNAT turns this

procedure F_Proc (X : access constant Character);
pragma Import (Fortran, F_Proc, "f_proc");

into the equivalent of:

void f_proc(char *);

Note that this does not have the extra x_len parameter.

An additional complication comes from some versions of the BLAS
using CHARACTER*1 rather than CHARACTER.  This is the case for
the reference BLAS distributed by Debian for example, but not
for the latest reference BLAS from netlib.org.  I understand that
this construction (CHARACTER*1) is not defined by the Fortran
standard.

For example DGEMV (which you import) has
      CHARACTER TRANS
in the netlib version, and
      CHARACTER*1 TRANS
in the Debian version.

It is conceivable that the extra parameters (which always come at
the end) are unused in the CHARACTER case.  The crashes I saw were
with code that used CHARACTER*1, however I never tested with the
CHARACTER versions.  If the extra parameters are unused, you will
most likely be OK, since I believe parameters are pushed on the
stack from right to left.

Best wishes,

Duncan.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]