Commit 36ea267b by Tobias Burnus Committed by Tobias Burnus

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
parent 5582f599
2011-01-28 Tobias Burnus <burnus@net-b.de> 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 * gfortran.texi (Fortran 2003 status): Mention support for
nonconstant namelist variables. nonconstant namelist variables.
......
...@@ -338,15 +338,17 @@ resolve_formal_arglist (gfc_symbol *proc) ...@@ -338,15 +338,17 @@ resolve_formal_arglist (gfc_symbol *proc)
if (gfc_pure (proc) && !sym->attr.pointer if (gfc_pure (proc) && !sym->attr.pointer
&& sym->attr.flavor != FL_PROCEDURE) && 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 " 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); &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 " gfc_error ("Argument '%s' of pure subroutine '%s' at %L must "
"have its INTENT specified", sym->name, proc->name, "have its INTENT specified or have the VALUE "
&sym->declared_at); "attribute", sym->name, proc->name, &sym->declared_at);
} }
if (proc->attr.implicit_pure && !sym->attr.pointer if (proc->attr.implicit_pure && !sym->attr.pointer
......
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> 2011-01-28 Jakub Jelinek <jakub@redhat.com>
PR target/42894 PR target/42894
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment