aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-12-16 00:25:36 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2012-12-16 00:25:36 +0100
commit25ffd46fa20b54b6190593c25d917b7e84a03570 (patch)
treea108d8774c3205b324a55d0ae3a96c25f330a937
parent25293279b2461d483999e3ffd9b1a1401d5dc64d (diff)
downloadgcc-25ffd46fa20b54b6190593c25d917b7e84a03570.zip
gcc-25ffd46fa20b54b6190593c25d917b7e84a03570.tar.gz
gcc-25ffd46fa20b54b6190593c25d917b7e84a03570.tar.bz2
re PR fortran/55638 (Wrongly accepts INTENT + VALUE - and wrongly requires it for PURE)
2012-12-16 Tobias Burnus <burnus@net-b.de> PR fortran/55638 * resolve.c (resolve_formal_arglist): Allow VALUE without INTENT for ELEMENTAL procedures. 2012-12-16 Tobias Burnus <burnus@net-b.de> PR fortran/55638 * gfortran.dg/elemental_args_check_3.f90: Update dg-error. * gfortran.dg/elemental_args_check_7.f90: New. From-SVN: r194525
-rw-r--r--gcc/fortran/ChangeLog10
-rw-r--r--gcc/fortran/resolve.c6
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/elemental_args_check_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/elemental_args_check_7.f9026
5 files changed, 45 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a067787..8efe003 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-16 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/55638
+ * resolve.c (resolve_formal_arglist): Allow VALUE without
+ INTENT for ELEMENTAL procedures.
+
2012-12-10 Janus Weil <janus@gcc.gnu.org>
PR fortran/52909
@@ -5,8 +11,8 @@
2012-12-09 Tobias Burnus <burnus@net-b.de>
- * 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 1c7b5fb..d4d5eb9 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 0360b7c..342a1a1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-16 Tobias Burnus <burnus@net-b.de>
+
+ 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 <ebotcazou@adacore.com>
* 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 77111f1..8d63874 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 0000000..7b5843b
--- /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