[Rd] f2c problem

Göran Broström gb@stat.umu.se
Wed, 20 Feb 2002 11:27:46 +0100 (CET)


On Wed, 20 Feb 2002, Stefano Iacus wrote:

> In building princurve package for MacOS I need to use f2c on fortran 
> files.
> 
> Here is the output of f2c for getlam.f
> 
> getlam.f:
>     getlam:
>     newlam:
>     lamix:
> Error on line 116 of getlam.f: Declaration error for v: adjustable 
> dimension on non-argument
> Error on line 116 of getlam.f: wr_ardecls:  nonconstant array size
> 
> what I found strange is that both newlam and get lam have definitions 
> like
> 
> 
>   subroutine newlam(n,p,sx,lambda,tag)
>        integer n,p,tag(n)
>        double precision sx(n,p),lambda(n),lami
> 
> 
> but for some reason f2c complains only with the last lamix subroutine
> 
>    subroutine lamix(ns,p,x,s,lambda,dismin,temps)
>        integer ns,p
>        double precision lambda,x(p),s(ns,p),dismin,temps(p)
>        double precision v(2,p),d1sqr,d2sqr,d12,dsqr, d1,w
> 
> probably because v is not passed as an argument.

Definitely because v is local; this construct is a gcc extension to the 
standard, I think. Solutions: 1) pass v as an argument and reserv space
in the calling function. 2) Instead of  p, use 1000 (or some other
large number, which p never will exceed). 3) Use gcc.

Göran
> 
> Any idea on how to manage this in f2c ?
> 
> Stefano
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-- 
 Göran Broström                      tel: +46 90 786 5223
 professor                           fax: +46 90 786 6614
 Department of Statistics            http://www.stat.umu.se/egna/gb/
 Umeå University
 SE-90187 Umeå, Sweden             e-mail: gb@stat.umu.se

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._