This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Problem with LOC intrinsic for assumed size arrays



On Jan 24, 2006, at 2:37 PM, Steve Kargl wrote:


On Tue, Jan 24, 2006 at 02:24:10PM -0800, Mark Hesselink wrote:

While trying to compile FMS (http://www.gfdl.noaa.gov/fms/) I came across a problem with the LOC intrinsic for assumed size arrays. The following code produces the error below:

PROGRAM loc_1
CONTAINS
   SUBROUTINE f (x)
      INTEGER, DIMENSION(*)   :: x
      INTEGER                 :: address
      address=LOC(*)
   END SUBROUTINE f
END PROGRAM loc_1

[aardschokker:fms/trunk/obj] mark% /usr/local/bin/gfortran -c loc_1.f90
In file loc_1.f90:6


      address=LOC(*)
                 1
Error: Syntax error in argument list at (1)


I don't use LOC, but this won't stop me from asking a question. Do you really mean "address=LOC(*)"? LOC() returns the address of a variable and * isn't a variable. Is this suppose to be "address=LOC(x)"?

I am so sorry. Yes, of course it is supposed to be LOC(x). Changing the line ``address=LOC(*)'' to ``address=LOC(x)'' produces the following result:


[aardschokker:fms/trunk/obj] mark% /usr/local/bin/gfortran -c loc_1.f90
 In file loc_1.f90:6

address=LOC(x)
1
Error: The upper bound in the last dimension must appear in the reference to the assumed size array 'x' at (1).


Thanks,

Mark

P.S. I apologize for the noise. I should have paid more attention before sending the email.


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