 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Mon Dec 10, 2012 10:58 pm Post subject: Illegal use of whole of assumed size arrays |
|
|
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 |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8255 Location: Salford, UK
|
Posted: Tue Dec 11, 2012 9:11 am Post subject: |
|
|
Thanks. I will log this as a bug. |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Sat Dec 22, 2012 12:20 am Post subject: |
|
|
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 |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8255 Location: Salford, UK
|
Posted: Sat Dec 22, 2012 8:56 am Post subject: |
|
|
Thanks for this. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8255 Location: Salford, UK
|
Posted: Mon Apr 08, 2013 2:16 pm Post subject: |
|
|
This bug has been fixed for the next release. |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Tue Apr 09, 2013 5:36 pm Post subject: |
|
|
Thanks Paul. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
|
|
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
|