replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Illegal use of whole of assumed size arrays
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Illegal use of whole of assumed size arrays

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Mon Dec 10, 2012 10:58 pm    Post subject: Illegal use of whole of assumed size arrays Reply with quote

In the code below, the reference to maxval with assumed size array a as an argument should be detected as an error at compile time.

Code:

module mmm
contains
function largest(a)
   real largest
   real, intent(in) :: a(*)  ! a is assumed size
   largest = maxval(a)     ! This should be detected as an error at compile time
end function largest
end module mmm

program anon
   use mmm
   real a(5), y
   a = (/(real(i),i=1,5)/)
   y = largest(a)
   print *, y
end program anon

_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl


Last edited by davidb on Tue Dec 11, 2012 8:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8255
Location: Salford, UK

PostPosted: Tue Dec 11, 2012 9:11 am    Post subject: Reply with quote

Thanks. I will log this as a bug.
Back to top
View user's profile Send private message AIM Address
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Sat Dec 22, 2012 12:20 am    Post subject: Reply with quote

One think to note when you come to look at this, is that this will also affect dummy array arguments with the last dimension declared as 1 when /OLD_ARRAYS is switched on.

e.g.

Code:

subroutine xxx(a, b, n)
   integer n
   real a(1), b(n,1) !< extent of last dimension not known with /OLD_ARRAYS
end


should be treated as equivalent to the following when /OLD_ARRAYS is active,

Code:

subroutine xxx(a, b, n)
   integer n
   real a(*), b(n,*) !< extent of last dimension not known
end

_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8255
Location: Salford, UK

PostPosted: Sat Dec 22, 2012 8:56 am    Post subject: Reply with quote

Thanks for this.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8255
Location: Salford, UK

PostPosted: Mon Apr 08, 2013 2:16 pm    Post subject: Reply with quote

This bug has been fixed for the next release.
Back to top
View user's profile Send private message AIM Address
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Tue Apr 09, 2013 5:36 pm    Post subject: Reply with quote

Thanks Paul.
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
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 © 2001, 2005 phpBB Group