public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/60777] New: Fortran 2003: RECURSIVE function rejected in specification expression
@ 2014-04-07 14:22 vladimir.fuka at gmail dot com
2014-04-07 14:29 ` [Bug fortran/60777] " kargl at gcc dot gnu.org
2014-04-09 8:32 ` dominiq at lps dot ens.fr
0 siblings, 2 replies; 3+ messages in thread
From: vladimir.fuka at gmail dot com @ 2014-04-07 14:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60777
Bug ID: 60777
Summary: Fortran 2003: RECURSIVE function rejected in
specification expression
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: vladimir.fuka at gmail dot com
John Harper reports on comp.lang.fortran:
! A recursive function in a specification expression
module recur
implicit none
contains
pure recursive function f(n) result(answer)
integer,intent(in) :: n
integer :: answer
if (n<2) then
answer = 1
else
answer = f(n-1)*n
end if
end function f ! factorial of max(n,0)
pure function usef( n)
integer,intent(in):: n
character(f(n)) :: usef
usef = repeat('*',f(n))
end function usef
end module recur
program testspecexpr
use recur
implicit none
integer :: n
do n = 1,3
print *,usef(n)
end do
end program testspecexpr
Which gives gfortran-4.9 resspec.f90
resspec.f90:18.16:
character(f(n)) :: usef
1
Error: Specification function 'f' at (1) cannot be RECURSIVE
but Fortran 2003 and 2008 just require:
7.1.11.6 (F2008): Evaluation of a specification expression shall not directly
or indirectly cause a procedure defined by the subprogram in which it appears
to be invoked.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/60777] Fortran 2003: RECURSIVE function rejected in specification expression
2014-04-07 14:22 [Bug fortran/60777] New: Fortran 2003: RECURSIVE function rejected in specification expression vladimir.fuka at gmail dot com
@ 2014-04-07 14:29 ` kargl at gcc dot gnu.org
2014-04-09 8:32 ` dominiq at lps dot ens.fr
1 sibling, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2014-04-07 14:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60777
--- Comment #1 from kargl at gcc dot gnu.org ---
Index: expr.c
===================================================================
--- expr.c (revision 208947)
+++ expr.c (working copy)
@@ -2733,12 +2733,10 @@ external_spec_function (gfc_expr *e)
return false;
}
- if (f->attr.recursive)
- {
- gfc_error ("Specification function '%s' at %L cannot be RECURSIVE",
- f->name, &e->where);
+ if (f->attr.recursive
+ && !gfc_notify_std (GFC_STD_F2003, "Specification function '%s' "
+ "at %L cannot be RECURSIVE", f->name, &e->where));
return false;
- }
return restricted_args (e->value.function.actual);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/60777] Fortran 2003: RECURSIVE function rejected in specification expression
2014-04-07 14:22 [Bug fortran/60777] New: Fortran 2003: RECURSIVE function rejected in specification expression vladimir.fuka at gmail dot com
2014-04-07 14:29 ` [Bug fortran/60777] " kargl at gcc dot gnu.org
@ 2014-04-09 8:32 ` dominiq at lps dot ens.fr
1 sibling, 0 replies; 3+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-04-09 8:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60777
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-04-09
Ever confirmed|0 |1
--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-09 8:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-07 14:22 [Bug fortran/60777] New: Fortran 2003: RECURSIVE function rejected in specification expression vladimir.fuka at gmail dot com
2014-04-07 14:29 ` [Bug fortran/60777] " kargl at gcc dot gnu.org
2014-04-09 8:32 ` dominiq at lps dot ens.fr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).