]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/55638 (Wrongly accepts INTENT + VALUE - and wrongly requires it for...
authorTobias Burnus <burnus@net-b.de>
Sat, 15 Dec 2012 23:25:36 +0000 (00:25 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Sat, 15 Dec 2012 23:25:36 +0000 (00:25 +0100)
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

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/elemental_args_check_3.f90
gcc/testsuite/gfortran.dg/elemental_args_check_7.f90 [new file with mode: 0644]

index a0677870baaa85b62d6636ba38f820025a04967d..8efe003240fd60999c4bf859f2b204d6e220e6ad 100644 (file)
@@ -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.
 
index 1c7b5fb64e13000614993a1f97697c8fca5c14b0..d4d5eb9b52d6c0ba357f499fe4100ba171a17080 100644 (file)
@@ -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;
            }
index 0360b7c407bca882512132fe50bc2727bd6faa59..342a1a1495744c14929c15270849248374d580f5 100644 (file)
@@ -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.
index 77111f1c519775f47ede3f5b98e70c29cb4a3a4c..8d63874579477023862e94fae3e3ad6cc0f6d790 100644 (file)
@@ -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 (file)
index 0000000..7b5843b
--- /dev/null
@@ -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