From: Tobias Burnus Date: Sat, 15 Dec 2012 23:25:36 +0000 (+0100) Subject: re PR fortran/55638 (Wrongly accepts INTENT + VALUE - and wrongly requires it for... X-Git-Tag: releases/gcc-4.8.0~1361 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25ffd46fa20b54b6190593c25d917b7e84a03570;p=thirdparty%2Fgcc.git re PR fortran/55638 (Wrongly accepts INTENT + VALUE - and wrongly requires it for PURE) 2012-12-16 Tobias Burnus PR fortran/55638 * resolve.c (resolve_formal_arglist): Allow VALUE without INTENT for ELEMENTAL procedures. 2012-12-16 Tobias Burnus PR fortran/55638 * gfortran.dg/elemental_args_check_3.f90: Update dg-error. * gfortran.dg/elemental_args_check_7.f90: New. From-SVN: r194525 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a0677870baaa..8efe003240fd 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2012-12-16 Tobias Burnus + + PR fortran/55638 + * resolve.c (resolve_formal_arglist): Allow VALUE without + INTENT for ELEMENTAL procedures. + 2012-12-10 Janus Weil PR fortran/52909 @@ -5,8 +11,8 @@ 2012-12-09 Tobias Burnus - * trans-array.c (gfc_deallocate_scalar_with_status): Use - NULL_TREE in the call to gfc_deallocate_scalar_with_status. + * trans-array.c (structure_alloc_comps): Use NULL_TREE in the + call to gfc_deallocate_scalar_with_status. * trans-decl.c (gfc_trans_deferred_vars): Pass symbol. * trans-stmt.c (gfc_trans_deallocate): Pass polymorphic variable. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 1c7b5fb64e13..d4d5eb9b52d6 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -488,10 +488,12 @@ resolve_formal_arglist (gfc_symbol *proc) continue; } - if (sym->attr.intent == INTENT_UNKNOWN) + /* Fortran 2008 Corrigendum 1, C1290a. */ + if (sym->attr.intent == INTENT_UNKNOWN && !sym->attr.value) { gfc_error ("Argument '%s' of elemental procedure '%s' at %L must " - "have its INTENT specified", sym->name, proc->name, + "have its INTENT specified or have the VALUE " + "attribute", sym->name, proc->name, &sym->declared_at); continue; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0360b7c407bc..342a1a149574 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-12-16 Tobias Burnus + + PR fortran/55638 + * gfortran.dg/elemental_args_check_3.f90: Update dg-error. + * gfortran.dg/elemental_args_check_7.f90: New. + 2012-12-15 Eric Botcazou * lib/scanasm.exp (get_ada_spec_filename): Use procedural form. diff --git a/gcc/testsuite/gfortran.dg/elemental_args_check_3.f90 b/gcc/testsuite/gfortran.dg/elemental_args_check_3.f90 index 77111f1c5197..8d6387457947 100644 --- a/gcc/testsuite/gfortran.dg/elemental_args_check_3.f90 +++ b/gcc/testsuite/gfortran.dg/elemental_args_check_3.f90 @@ -13,7 +13,7 @@ CONTAINS (a, & ! { dg-error "must be scalar" } b, & ! { dg-error "POINTER attribute" } c, & ! { dg-error "ALLOCATABLE attribute" } - d) ! { dg-error "INTENT specified" } + d) ! { dg-error "must have its INTENT specified or have the VALUE attribute" } INTEGER, INTENT(IN) :: a(:) INTEGER, POINTER, INTENT(IN) :: b INTEGER, ALLOCATABLE, INTENT(IN) :: c diff --git a/gcc/testsuite/gfortran.dg/elemental_args_check_7.f90 b/gcc/testsuite/gfortran.dg/elemental_args_check_7.f90 new file mode 100644 index 000000000000..7b5843b950b9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/elemental_args_check_7.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } +! +! PR fortran/55638 +! +! Additionally, VALUE no INTENT is required (and only "intent(in)" allowed) +! + + elemental subroutine foo(x, y, z) + integer, intent(inout) :: x + integer, VALUE :: y + integer, VALUE, intent(in) :: z + x = y + end subroutine foo + + impure elemental subroutine foo2(x, y, z) ! { dg-error "Argument 'x' of elemental procedure 'foo2' at .1. must have its INTENT specified or have the VALUE attribute" } + integer :: x + integer, VALUE :: y + integer, VALUE :: z + x = y + end subroutine foo2 + + subroutine foo3(x, y, z) + integer, VALUE, intent(in) :: x + integer, VALUE, intent(inout) :: y ! { dg-error "VALUE attribute conflicts with INTENT.INOUT. attribute" } + integer, VALUE, intent(out) :: z ! { dg-error "VALUE attribute conflicts with INTENT.OUT. attribute" } + end subroutine foo3