Commit 4056cc1b by Janus Weil

re PR fortran/50547 (dummy procedure argument of PURE shall be PURE)

2011-09-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/50547
	* resolve.c (resolve_formal_arglist): Fix pureness check for dummy
	functions.

	PR fortran/50553
	* symbol.c (check_conflict): Forbid TARGET attribute for statement
	functions.


2011-09-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/50547
	* gfortran.dg/pure_formal_proc_3.f90: New.

	PR fortran/50553
	* gfortran.dg/stfunc_7.f90: New.

From-SVN: r179345
parent 6c7dfafe
2011-09-29 Janus Weil <janus@gcc.gnu.org>
PR fortran/50547
* resolve.c (resolve_formal_arglist): Fix pureness check for dummy
functions.
PR fortran/50553
* symbol.c (check_conflict): Forbid TARGET attribute for statement
functions.
2011-09-27 Jakub Jelinek <jakub@redhat.com> 2011-09-27 Jakub Jelinek <jakub@redhat.com>
* trans-types.c (gfc_type_for_size): Return wider type * trans-types.c (gfc_type_for_size): Return wider type
......
...@@ -269,18 +269,21 @@ resolve_formal_arglist (gfc_symbol *proc) ...@@ -269,18 +269,21 @@ resolve_formal_arglist (gfc_symbol *proc)
if (sym->attr.if_source != IFSRC_UNKNOWN) if (sym->attr.if_source != IFSRC_UNKNOWN)
resolve_formal_arglist (sym); resolve_formal_arglist (sym);
if (sym->attr.subroutine || sym->attr.external || sym->attr.intrinsic) /* F08:C1279. */
{ if (gfc_pure (proc)
if (gfc_pure (proc) && !gfc_pure (sym)) && sym->attr.flavor == FL_PROCEDURE && !gfc_pure (sym))
{ {
gfc_error ("Dummy procedure '%s' of PURE procedure at %L must " gfc_error ("Dummy procedure '%s' of PURE procedure at %L must "
"also be PURE", sym->name, &sym->declared_at); "also be PURE", sym->name, &sym->declared_at);
continue; continue;
} }
if (sym->attr.subroutine || sym->attr.external || sym->attr.intrinsic)
{
if (proc->attr.implicit_pure && !gfc_pure(sym)) if (proc->attr.implicit_pure && !gfc_pure(sym))
proc->attr.implicit_pure = 0; proc->attr.implicit_pure = 0;
/* F08:C1289. */
if (gfc_elemental (proc)) if (gfc_elemental (proc))
{ {
gfc_error ("Dummy procedure at %L not allowed in ELEMENTAL " gfc_error ("Dummy procedure at %L not allowed in ELEMENTAL "
...@@ -382,7 +385,7 @@ resolve_formal_arglist (gfc_symbol *proc) ...@@ -382,7 +385,7 @@ resolve_formal_arglist (gfc_symbol *proc)
if (gfc_elemental (proc)) if (gfc_elemental (proc))
{ {
/* F2008, C1289. */ /* F08:C1289. */
if (sym->attr.codimension) if (sym->attr.codimension)
{ {
gfc_error ("Coarray dummy argument '%s' at %L to elemental " gfc_error ("Coarray dummy argument '%s' at %L to elemental "
......
...@@ -684,6 +684,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) ...@@ -684,6 +684,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
{ {
case PROC_ST_FUNCTION: case PROC_ST_FUNCTION:
conf2 (dummy); conf2 (dummy);
conf2 (target);
break; break;
case PROC_MODULE: case PROC_MODULE:
......
2011-09-29 Janus Weil <janus@gcc.gnu.org>
PR fortran/50547
* gfortran.dg/pure_formal_proc_3.f90: New.
PR fortran/50553
* gfortran.dg/stfunc_7.f90: New.
2011-09-29 Artjoms Sinkarovs <artyom.shinkaroff@gmail.com> 2011-09-29 Artjoms Sinkarovs <artyom.shinkaroff@gmail.com>
* gcc.c-torture/execute/vector-compare-1.c: New testcase. * gcc.c-torture/execute/vector-compare-1.c: New testcase.
......
! { dg-do compile }
!
! PR 50547: dummy procedure argument of PURE shall be PURE
!
! Contributed by Vittorio Zecca <zeccav@gmail.com>
pure function f(proc)
interface
function proc() ! { dg-error "must also be PURE" }
end
end interface
end
! { dg-do compile }
! { dg-options "-std=legacy" }
!
! PR 50553: statement function cannot be target (r178939)
!
! Contributed by Vittorio Zecca <zeccav@gmail.com>
f(x)=x
target f ! { dg-error "attribute conflicts with" }
end
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