summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-25 19:02:47 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-25 19:02:47 +0000
commit4b20e9cf21088f96f94e546a7233e7e47cd58de3 (patch)
treef397c928bad869f8e29759c8674fbc0aa6fa3e43 /gcc
parent1b37751e20018b7c3fc58446fc80066f8698088a (diff)
downloadgcc-4b20e9cf21088f96f94e546a7233e7e47cd58de3.tar.gz
2010-06-25 Tobias Burnus <burnus@net-b.de>
* decl.c (gfc_match_entry): Allow END besides END SUBROUTINE/END FUNCTION for contained procedures. 2010-06-25 Tobias Burnus <burnus@net-b.de> * gfortran.dg/end_subroutine_1.f90: New. * gfortran.dg/end_subroutine_2.f90: New. * gfortran.dg/interface_proc_end.f90: Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161406 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/decl.c9
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/end_subroutine_1.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/end_subroutine_2.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/interface_proc_end.f905
6 files changed, 61 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b635aec7e61..b3da9a312a1 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,10 @@
2010-06-25 Tobias Burnus <burnus@net-b.de>
+ * decl.c (gfc_match_entry): Allow END besides
+ END SUBROUTINE/END FUNCTION for contained procedures.
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
* parse.c (next_free, next_fixed): Allow ";" as first character.
2010-06-24 Tobias Burnus <burnus@net-b.de>
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index aa7a2668fce..73bc81c14bf 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -5642,7 +5642,14 @@ gfc_match_end (gfc_statement *st)
if (gfc_match_eos () == MATCH_YES)
{
- if (!eos_ok)
+ if (!eos_ok && (*st == ST_END_SUBROUTINE || *st == ST_END_FUNCTION))
+ {
+ if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: END statement "
+ "instead of %s statement at %L",
+ gfc_ascii_statement (*st), &old_loc) == FAILURE)
+ goto cleanup;
+ }
+ else if (!eos_ok)
{
/* We would have required END [something]. */
gfc_error ("%s statement expected at %L",
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 85cb46b90e1..b71f7787acf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2010-06-25 Tobias Burnus <burnus@net-b.de>
+ * gfortran.dg/end_subroutine_1.f90: New.
+ * gfortran.dg/end_subroutine_2.f90: New.
+ * gfortran.dg/interface_proc_end.f90: Update.
+
+2010-06-25 Tobias Burnus <burnus@net-b.de>
+
* gfortran.dg/semicolon_fixed.f: Update.
* gfortran.dg/semicolon_fixed_2.f: New.
* gfortran.dg/semicolon_free_2.f90: New.
diff --git a/gcc/testsuite/gfortran.dg/end_subroutine_1.f90 b/gcc/testsuite/gfortran.dg/end_subroutine_1.f90
new file mode 100644
index 00000000000..b42f950546b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/end_subroutine_1.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-std=f2008" }
+!
+interface
+ subroutine foo()
+ end
+ integer function bar()
+ end
+end interface
+contains
+ subroutine test()
+ end
+ integer function f()
+ f = 42
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/end_subroutine_2.f90 b/gcc/testsuite/gfortran.dg/end_subroutine_2.f90
new file mode 100644
index 00000000000..8f2e3d10a13
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/end_subroutine_2.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+program main
+interface
+ subroutine foo()
+ end
+ integer function bar()
+ end
+end interface
+contains
+ subroutine test()
+ end ! { dg-error "Fortran 2008: END statement instead of END SUBROUTINE" }
+ end subroutine ! To silence successive errors
+end program
+
+subroutine test2()
+contains
+ integer function f()
+ f = 42
+ end ! { dg-error "Fortran 2008: END statement instead of END FUNCTION" }
+ end function ! To silence successive errors
+end subroutine test2
+
diff --git a/gcc/testsuite/gfortran.dg/interface_proc_end.f90 b/gcc/testsuite/gfortran.dg/interface_proc_end.f90
index ab95b794268..2fc9921df41 100644
--- a/gcc/testsuite/gfortran.dg/interface_proc_end.f90
+++ b/gcc/testsuite/gfortran.dg/interface_proc_end.f90
@@ -14,6 +14,5 @@
REAL :: TLS1,TLS2
END ! OK
END INTERFACE
- end ! { dg-error "END SUBROUTINE statement" }
- end module ! { dg-error "END SUBROUTINE statement" }
-! { dg-error "Unexpected end of file" "" { target "*-*-*" } 0 }
+ end subroutine
+ end module