]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/87233 (Constraint C1279 still followed after f2008 standard revision...
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 14 Jul 2019 22:52:58 +0000 (22:52 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 14 Jul 2019 22:52:58 +0000 (22:52 +0000)
2019-07-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/87233
* expr.c (check_restricted): Relax constraint C1279 which was
removed from F2008 and above.

* gfortran.dg/initialization_14.f90: Modify to now pass by
removing two dg-error commands. Added comments.
* gfortran.dg/initialization_30.f90: New test that includes the
two tests removed above with the 'dg-options -std=f95'.

From-SVN: r273484

gcc/fortran/ChangeLog
gcc/fortran/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/initialization_14.f90
gcc/testsuite/gfortran.dg/initialization_30.f90 [new file with mode: 0644]

index 0376f00ed53ae6f9b4f0f262be5edaf51365df1f..c92c85a3a76a3b68a7a2b4fded6a969788002ecb 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/87233
+       * expr.c (check_restricted): Relax constraint C1279 which was
+       removed from F2008 and above.
+
 2019-07-07  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/91077
index ec9e3288b48bd736ea92b995c90da466bd390d50..a1643707662a794b32bac3b93d088c0696ef6eee 100644 (file)
@@ -3305,12 +3305,14 @@ check_restricted (gfc_expr *e)
         restricted expression in an elemental procedure, it will have
         already been simplified away once we get here.  Therefore we
         don't need to jump through hoops to distinguish valid from
-        invalid cases.  */
-      if (sym->attr.dummy && sym->ns == gfc_current_ns
+        invalid cases.  Allowed in F2008 and F2018.  */
+      if (gfc_notification_std (GFC_STD_F2008)
+         && sym->attr.dummy && sym->ns == gfc_current_ns
          && sym->ns->proc_name && sym->ns->proc_name->attr.elemental)
        {
-         gfc_error ("Dummy argument %qs not allowed in expression at %L",
-                    sym->name, &e->where);
+         gfc_error_now ("Dummy argument %qs not "
+                        "allowed in expression at %L",
+                        sym->name, &e->where);
          break;
        }
 
index b22a8c78046eb273ed00cea7d7b2bac5739907b9..ae16c7da40885162d256d293ed23a6d9deeda528 100644 (file)
@@ -1,3 +1,11 @@
+2019-07-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/87233
+       * gfortran.dg/initialization_14.f90: Modify to now pass by
+       removing two dg-error commands. Added comments.
+       * gfortran.dg/initialization_30.f90: New test that includes the
+       two tests removed above with the 'dg-options -std=f95'.
+
 2019-07-14  Uroš Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/tree-ssa/pr84512.c (dg-final): Remove XFAIL on alpha*-*-*.
index 4d5b6856cf015b306fe24be28dd7297bbc5206a3..aa1437719aca71b91ca1ca11374dbcfc0e209ad9 100644 (file)
@@ -3,18 +3,18 @@
 ! Dummy arguments are disallowed in initialization expressions in
 ! elemental functions except as arguments to the intrinsic functions
 ! BIT_SIZE, KIND, LEN, or to the numeric inquiry functions listed
-! in 13.11.8
+! in 13.11.8 F95, likewise not allowed in F2003, now allowed in F2008.
 MODULE TT
 INTEGER M
 CONTAINS
    ELEMENTAL REAL FUNCTION two(N)
      INTEGER, INTENT(IN) :: N
-     INTEGER, DIMENSION(N) :: scr ! { dg-error "Dummy argument 'n' not allowed in expression" }
+     INTEGER, DIMENSION(N) :: scr ! Now valid under F2008
    END FUNCTION
 
    ELEMENTAL REAL FUNCTION twopointfive(N)
      INTEGER, INTENT(IN) :: N
-     INTEGER, DIMENSION(MAX(N,2)) :: scr ! { dg-error "Dummy argument 'n' not allowed in expression" }
+     INTEGER, DIMENSION(MAX(N,2)) :: scr ! Now valid under F2008
    end FUNCTION twopointfive
 
    REAL FUNCTION three(N)
diff --git a/gcc/testsuite/gfortran.dg/initialization_30.f90 b/gcc/testsuite/gfortran.dg/initialization_30.f90
new file mode 100644 (file)
index 0000000..ff8436b
--- /dev/null
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+! PR 20851
+! Dummy arguments are disallowed in initialization expressions in
+! elemental functions except as arguments to the intrinsic functions
+! BIT_SIZE, KIND, LEN, or to the numeric inquiry functions listed
+! in 13.11.8
+MODULE TT
+INTEGER M
+CONTAINS
+   ELEMENTAL REAL FUNCTION two(N)
+     INTEGER, INTENT(IN) :: N
+     INTEGER, DIMENSION(N) :: scr ! { dg-error "Dummy argument 'n' not allowed in expression" }
+   END FUNCTION
+
+   ELEMENTAL REAL FUNCTION twopointfive(N)
+     INTEGER, INTENT(IN) :: N
+     INTEGER, DIMENSION(MAX(N,2)) :: scr ! { dg-error "Dummy argument 'n' not allowed in expression" }
+   end FUNCTION twopointfive
+END MODULE
+END