Commit a26e8df4 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/47550 (PURE with VALUE and w/o INTENT: add gfc_notify_std (GFC_STD_F2008 ?)

2011-02-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/47550
        * resolve.c (resolve_formal_arglist): PURE with VALUE
        and no INTENT: Add -std= diagnostics.

2011-02-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/47550
        * gfortran.dg/pure_formal_2.f90: New.

From-SVN: r170060
parent 3f82421f
2011-02-11 Tobias Burnus <burnus@net-b.de>
PR fortran/47550
* resolve.c (resolve_formal_arglist): PURE with VALUE
and no INTENT: Add -std= diagnostics.
2011-02-09 Janus Weil <janus@gcc.gnu.org> 2011-02-09 Janus Weil <janus@gcc.gnu.org>
PR fortran/47352 PR fortran/47352
......
...@@ -341,18 +341,32 @@ resolve_formal_arglist (gfc_symbol *proc) ...@@ -341,18 +341,32 @@ 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) {
if (sym->attr.value)
gfc_notify_std (GFC_STD_F2008, "Fortran 2008: Argument '%s' "
"of pure function '%s' at %L with VALUE "
"attribute but without INTENT(IN)", sym->name,
proc->name, &sym->declared_at);
else
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) or VALUE", 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) {
if (sym->attr.value)
gfc_notify_std (GFC_STD_F2008, "Fortran 2008: Argument '%s' "
"of pure subroutine '%s' at %L with VALUE "
"attribute but without INTENT", sym->name,
proc->name, &sym->declared_at);
else
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 or have the VALUE " "have its INTENT specified or have the VALUE "
"attribute", sym->name, proc->name, &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
&& sym->attr.flavor != FL_PROCEDURE) && sym->attr.flavor != FL_PROCEDURE)
......
2011-02-11 Tobias Burnus <burnus@net-b.de>
PR fortran/47550
* gfortran.dg/pure_formal_2.f90: New.
2011-02-11 Pat Haugen <pthaugen@us.ibm.com> 2011-02-11 Pat Haugen <pthaugen@us.ibm.com>
PR rtl-optimization/47614 PR rtl-optimization/47614
......
! { dg-do compile }
! { dg-options "-std=f2003" }
!
! PR fortran/47550
! Follow up to: PR fortran/47507
!
! PURE procedures: Allow arguments w/o INTENT if they are VALUE
!
pure function f(x) ! { dg-error "Fortran 2008: Argument 'x' of pure function" }
real, VALUE :: x
real :: f
f = sin(x)
end function f
pure subroutine sub(x) ! { dg-error "Fortran 2008: Argument 'x' of pure subroutine" }
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