summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-31 17:16:06 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-31 17:16:06 +0000
commit4c7093c28bed4aeab4a6f0457f8631830465fdec (patch)
treec17275a2aa720df2f31c19545be1af6909c60919 /gcc
parent87fda26cce916e0b0596b2d5d5fbd3fa2bd2cf58 (diff)
downloadgcc-4c7093c28bed4aeab4a6f0457f8631830465fdec.tar.gz
gcc/fortran/
2014-12-31 Tobias Burnus <burnus@net-b.de> * match.c (gfc_match_stopcode): Permit error stop in pure procedures with F2015. gcc/testsuite/ 2014-12-31 Tobias Burnus <burnus@net-b.de> * gfortran.dg/error_stop_3.f90: New. * gfortran.dg/error_stop_4.f90: New. * gfortran.dg/coarray_3.f90: Remove a dg-error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219127 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/match.c18
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/error_stop_3.f909
-rw-r--r--gcc/testsuite/gfortran.dg/error_stop_4.f909
6 files changed, 44 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 10ad0bf2a35..b102e312e98 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-31 Tobias Burnus <burnus@net-b.de>
+
+ * match.c (gfc_match_stopcode): Permit error stop in pure
+ procedures with F2015.
+
2014-12-31 Uros Bizjak <ubizjak@gmail.com>
* trans-array.c (trans_array_bound_check): Use xasprintf instead
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index fb68eec6ee8..2b4202bc96d 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2557,7 +2557,8 @@ gfc_match_cycle (void)
}
-/* Match a number or character constant after an (ALL) STOP or PAUSE statement. */
+/* Match a number or character constant after an (ERROR) STOP or PAUSE
+ statement. */
static match
gfc_match_stopcode (gfc_statement st)
@@ -2581,9 +2582,18 @@ gfc_match_stopcode (gfc_statement st)
if (gfc_pure (NULL))
{
- gfc_error ("%s statement not allowed in PURE procedure at %C",
- gfc_ascii_statement (st));
- goto cleanup;
+ if (st == ST_ERROR_STOP)
+ {
+ if (!gfc_notify_std (GFC_STD_F2015, "%s statement at %C in PURE "
+ "procedure", gfc_ascii_statement (st)))
+ goto cleanup;
+ }
+ else
+ {
+ gfc_error ("%s statement not allowed in PURE procedure at %C",
+ gfc_ascii_statement (st));
+ goto cleanup;
+ }
}
gfc_unset_implicit_pure (NULL);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 03531d386fc..96ca31472c1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-31 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/error_stop_3.f90: New.
+ * gfortran.dg/error_stop_4.f90: New.
+ * gfortran.dg/coarray_3.f90: Remove a dg-error.
+
2014-12-31 Iain Sandoe <iain@codesourcery.com>
* obj-c++.dg/lambda-0.mm New.
diff --git a/gcc/testsuite/gfortran.dg/coarray_3.f90 b/gcc/testsuite/gfortran.dg/coarray_3.f90
index 63c3bd33571..aba4eb1bc84 100644
--- a/gcc/testsuite/gfortran.dg/coarray_3.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_3.f90
@@ -79,7 +79,7 @@ pure subroutine pureSub()
critical ! { dg-error "Image control statement CRITICAL" }
end critical ! { dg-error "Expecting END SUBROUTINE statement" }
sync all ! { dg-error "Image control statement SYNC" }
- error stop ! { dg-error "not allowed in PURE procedure" }
+ error stop
end subroutine pureSub
diff --git a/gcc/testsuite/gfortran.dg/error_stop_3.f90 b/gcc/testsuite/gfortran.dg/error_stop_3.f90
new file mode 100644
index 00000000000..43747397e59
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/error_stop_3.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-std=gnu" }
+!
+! F2015 permits ERROR STOP in PURE procedures
+! FIXME: Change to -std=f2015, when available
+!
+pure subroutine foo()
+ error stop "failed"
+end
diff --git a/gcc/testsuite/gfortran.dg/error_stop_4.f90 b/gcc/testsuite/gfortran.dg/error_stop_4.f90
new file mode 100644
index 00000000000..a28aa3755b2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/error_stop_4.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-std=f2008ts" }
+!
+! F2015 permits ERROR STOP in PURE procedures
+! FIXME: Change to error_stop_3.f90 to -std=f2015.
+!
+pure subroutine foo()
+ error stop "failed" ! { dg-error "GNU Extension: ERROR STOP statement at .1. in PURE procedure" }
+end