PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

A simple question about "allocatable"

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Landau



Joined: 27 Mar 2005
Posts: 3

PostPosted: Sun Mar 27, 2005 10:05 am    Post subject: A simple question about "allocatable" Reply with quote

I'm trying to allocate an array in the main program using a subroutine. But pgf90 compiler gave me that "PGF90-S-0084-Illegal use of symbol arr - must be an allocatable array (mainprogram.f90: 19)"
Help!
My code (very simple):
-------------------------------------------------------------------------
program main
implicit none
interface
subroutine allocatearray(arr,leng)
real(8),allocatable :: arr(:)
integer:: leng
end subroutine allocatearray
end interface
real(8), allocatable:: a(:)
call allocatearray(a,10)
print*, a
end program main

subroutine allocatearray(arr,leng)
implicit none
real(8),target, allocatable :: arr(:) ! I have declared arr here.
integer:: leng
integer:: error
allocate(arr(leng),stat=error)
arr=3.1415926
print*, arr
end subroutine allocatearray
-----------------------------------------------------------------
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6141
Location: The Portland Group Inc.

PostPosted: Mon Mar 28, 2005 10:13 am    Post subject: Reply with quote

Hi Landau,


Unfortunately, using an allocatable as part of the dummy argument is illegal in Fortran 90/95. There is an extension that has been adopted in the F2003 standard that does allow this, but as of yet, pgf90 has not added this extension.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group