This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Ada] new Ada2005 units
- From: Duncan Sands <baldrick at free dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Arnaud Charlet <charlet at adacore dot com>, Geert Bosch <bosch at adacore dot com>, Robert Dewar <dewar at adacore dot com>
- Date: Mon, 9 Apr 2007 11:47:57 +0200
- Subject: Re: [Ada] new Ada2005 units
- References: <20070409081858.GA3581@adacore.com>
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.