This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions
- From: "tow21 at cam dot ac dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Mar 2005 19:56:59 -0000
- Subject: [Bug fortran/20323] New: optional arguments incorrectly accepted in specification expressions
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In the program below, the optional argument arg is used as part of the
specification expression for the length of a string. This is forbidden by
section 7.1.6.2; constraint (2) of the F95 standard (and wouldn't make
much sense anyway - what happens when the function is called without the
optional argument?)
gfortran accepts it without complaint, though.
parabrisas:~/test% cat testpresent.f90
function testpresent(arg)
integer, intent(in), optional :: arg
character(len=arg) :: s
logical :: testpresent
testpresent=.true.
end function testpresent
parabrisas:~/test% gfortran -c testpresent.f90
parabrisas:~/test% gfortran -v
Using built-in specs.
Configured with: ../gcc/configure --prefix=/home/tow/root/gcc-4.0
--enable-languages=c,f95 : (reconfigured) ../gcc/configure
--prefix=/home/tow/root/gcc-4.0
--with-gcc-version-trigger=/home/tow/dl/gcc/gcc/gcc/version.c
--enable-languages=c,f95 --no-create --no-recursion :
(reconfigured) ../gcc/configure --prefix=/home/tow/root/gcc-4.0
--with-gcc-version-trigger=/home/tow/dl/gcc/gcc/gcc/version.c
--enable-languages=c,f95 --no-create --no-recursion
Thread model: posix
gcc version 4.0.0 20050127 (experimental)
--
Summary: optional arguments incorrectly accepted in specification
expressions
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tow21 at cam dot ac dot uk
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20323