aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2019-07-14 22:52:58 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2019-07-14 22:52:58 +0000
commit1b034a958d4255f1cf57463655b9c74ec1e329bb (patch)
treef8fb10ad522b358bed6b32e200069c3a57d816db /gcc
parentc5e02838afa5a79091dc22b480951fc5effb42e6 (diff)
downloadgcc-1b034a958d4255f1cf57463655b9c74ec1e329bb.zip
gcc-1b034a958d4255f1cf57463655b9c74ec1e329bb.tar.gz
gcc-1b034a958d4255f1cf57463655b9c74ec1e329bb.tar.bz2
re PR fortran/87233 (Constraint C1279 still followed after f2008 standard revision (?))
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/expr.c10
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gfortran.dg/initialization_14.f906
-rw-r--r--gcc/testsuite/gfortran.dg/initialization_30.f9021
5 files changed, 44 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 0376f00..c92c85a 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index ec9e328..a164370 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b22a8c7..ae16c7d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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*-*-*.
diff --git a/gcc/testsuite/gfortran.dg/initialization_14.f90 b/gcc/testsuite/gfortran.dg/initialization_14.f90
index 4d5b685..aa14377 100644
--- a/gcc/testsuite/gfortran.dg/initialization_14.f90
+++ b/gcc/testsuite/gfortran.dg/initialization_14.f90
@@ -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
index 0000000..ff8436b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/initialization_30.f90
@@ -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