From 898344a944c18e89047d4293468a28202aa3190d Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Mon, 18 May 2015 23:26:38 +0000 Subject: [PATCH] re PR fortran/66057 (ICE for incomplete generic statement (gfc_match_generic)) 2015-05-18 Steven G. Kargl PR fortran/66057 * interface.c(gfc_match_end_interface): Enforce F2008 C1202 (R1201). * match.c(gfc_op2string): Return 'none' for INTRINSIC_NONE. 2015-05-18 Steven G. Kargl PR fortran/66057 * gfortran.dg/interface_operator_1.f90: New tests. From-SVN: r223326 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/interface.c | 8 ++++++-- gcc/fortran/match.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/interface_operator_1.f90 | 10 ++++++++++ 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/interface_operator_1.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0650883fd91..de7be7aa65d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-05-18 Steven G. Kargl + + PR fortran/66106 + * interface.c(gfc_match_end_interface): Enforce F2008 C1202 (R1201). + * match.c(gfc_op2string): Return 'none' for INTRINSIC_NONE. + 2015-05-18 Steven G. Kargl PR fortran/66057 diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 0501c1d1543..d011d846d31 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -346,8 +346,12 @@ gfc_match_end_interface (void) break; m = MATCH_ERROR; - gfc_error ("Expecting % at %C, " - "but got %s", s1, s2); + if (strcmp(s2, "none") == 0) + gfc_error ("Expecting % " + "at %C, ", s1); + else + gfc_error ("Expecting % at %C, " + "but got %s", s1, s2); } } diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 8234c277243..3e12483cc0f 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -110,6 +110,9 @@ gfc_op2string (gfc_intrinsic_op op) case INTRINSIC_PARENTHESES: return "parens"; + case INTRINSIC_NONE: + return "none"; + default: break; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5d4dce2e6f9..a5c147be13a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-18 Steven G. Kargl + + PR fortran/66106 + * gfortran.dg/interface_operator_1.f90: New tests. + 2015-05-18 Steven G. Kargl PR fortran/66057 diff --git a/gcc/testsuite/gfortran.dg/interface_operator_1.f90 b/gcc/testsuite/gfortran.dg/interface_operator_1.f90 new file mode 100644 index 00000000000..97d260a2b98 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_operator_1.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! PR fortran/66106 +! +! Original code from Gerhard Steinmetz +! +program p + interface operator ( .gt. ) + end interface operator ! { dg-error "END INTERFACE OPERATOR" } +end program p ! { dg-error "END INTERFACE" } +! { dg-excess-errors "Unexpected end of file" } -- 2.30.2