re PR fortran/47507 (PURE functions with VALUE arguments invalidly rejectd)

2011-01-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/47507
        * resolve.c (resolve_formal_arglist): Allow arguments with VALUE
        attribute also without INTENT.

2011-01-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/47507
        * gfortran.dg/pure_formal_1.f90: New.

From-SVN: r169372
This commit is contained in:
Tobias Burnus 2011-01-28 20:49:25 +01:00 committed by Tobias Burnus
parent 5582f599f6
commit 36ea267b8a
4 changed files with 34 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2011-01-28 Tobias Burnus <burnus@net-b.de>
PR fortran/47507
* resolve.c (resolve_formal_arglist): Allow arguments with VALUE
attribute also without INTENT.
2011-01-28 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (Fortran 2003 status): Mention support for

View file

@ -338,15 +338,17 @@ resolve_formal_arglist (gfc_symbol *proc)
if (gfc_pure (proc) && !sym->attr.pointer
&& sym->attr.flavor != FL_PROCEDURE)
{
if (proc->attr.function && sym->attr.intent != INTENT_IN)
if (proc->attr.function && sym->attr.intent != INTENT_IN
&& !sym->attr.value)
gfc_error ("Argument '%s' of pure function '%s' at %L must be "
"INTENT(IN)", sym->name, proc->name,
"INTENT(IN) or VALUE", sym->name, proc->name,
&sym->declared_at);
if (proc->attr.subroutine && sym->attr.intent == INTENT_UNKNOWN)
if (proc->attr.subroutine && sym->attr.intent == INTENT_UNKNOWN
&& !sym->attr.value)
gfc_error ("Argument '%s' of pure subroutine '%s' at %L must "
"have its INTENT specified", sym->name, proc->name,
&sym->declared_at);
"have its INTENT specified or have the VALUE "
"attribute", sym->name, proc->name, &sym->declared_at);
}
if (proc->attr.implicit_pure && !sym->attr.pointer

View file

@ -1,3 +1,8 @@
2011-01-28 Tobias Burnus <burnus@net-b.de>
PR fortran/47507
* gfortran.dg/pure_formal_1.f90: New.
2011-01-28 Jakub Jelinek <jakub@redhat.com>
PR target/42894

View file

@ -0,0 +1,16 @@
! { dg-do compile }
!
! PR fortran/47507
!
! PURE procedures: Allow arguments w/o INTENT if they are VALUE
!
pure function f(x)
real, VALUE :: x
real :: f
f = sin(x)
end function f
pure subroutine sub(x)
real, VALUE :: x
end subroutine sub