This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
checking array bounds for actual arguments
- From: "Janus Weil" <jaydub66 at googlemail dot com>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Tue, 25 Sep 2007 17:08:49 +0200
- Subject: checking array bounds for actual arguments
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=wceVqCD7EHO10M8yrHXAfH6huWa2melp2t/tO3h0vgc=; b=VqPpkvgzEhB1wJv2whvgGL3WSXoiX4BmMnk95MDT5pWnZXzPs53GhtQBphwcFZ/3kL866x0yOVzUw/wo3ce7KC3qwnOWruAPfctnZz6Z1wPSfHIBtT9q487w7kofFWZyv+XFztZHyQWt2TGXrRKykZO4mpQTRz+OVtSDpZoFBU8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=kHyrM41rZ7/EPkF1qtoCixTDiqKT/OX31yhXertX2OUZxZX2JAer2AQBdPHjljEV+PE72/1cOjOHWkvsmGZBCL0/rbytIRqNf65SNneIBS1plIct6AB5bKKkzvCxSiqTP70wzGcjALdnelwGU82wp9rPNhqehZTqrnyDZUNMp2A=
Hi all,
I have a question regarding the following code sample:
program main
implicit none
real x(2),y(3),z(4)
call a(x)
call a(y)
call a(z)
contains
subroutine a(x)
implicit none
real x(3)
write(*,*) 'x=',x
end subroutine a
end program main
For the first call of the subroutine I get this warning:
call a(x)
1
Warning: Actual argument contains too few elements for dummy argument
'x' (2/3) at (1)
But for "call a(z)" I don't get any warning, although the shape of the
array does not match either. Is there any way to make gfortran issue a
warning for such a case? And if not, do think it would make sense to
implement such a check?
Cheers,
Janus