summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-25 22:28:04 +0000
committerkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-25 22:28:04 +0000
commit8ec43c086d7b329690a68d75325a52342f2286fe (patch)
treecd8d26ee1087aa34ae4c31ad5454adeaeb71bf91
parent39996977b0626dc55ec48eba22e8edf42ef627d3 (diff)
downloadgcc-8ec43c086d7b329690a68d75325a52342f2286fe.tar.gz
2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67525 * parse.c (match_deferred_characteristics): Remove an assert, which allows an invalid SELECT TYPE selector to be detected. 2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/67525 * gfortran.dg/pr67525.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228155 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/parse.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr67525.f9018
4 files changed, 36 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 8e33a1d231c..1e3a7a13e2b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/67525
+ * parse.c (match_deferred_characteristics): Remove an assert, which
+ allows an invalid SELECT TYPE selector to be detected.
+
2015-09-25 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR pretty-print/67567
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 62bcb61e96e..f8d84de306a 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -3113,15 +3113,18 @@ match_deferred_characteristics (gfc_typespec * ts)
static void
check_function_result_typed (void)
{
- gfc_typespec* ts = &gfc_current_ns->proc_name->result->ts;
+ gfc_typespec ts;
gcc_assert (gfc_current_state () == COMP_FUNCTION);
- gcc_assert (ts->type != BT_UNKNOWN);
+
+ if (!gfc_current_ns->proc_name->result) return;
+
+ ts = gfc_current_ns->proc_name->result->ts;
/* Check type-parameters, at the moment only CHARACTER lengths possible. */
/* TODO: Extend when KIND type parameters are implemented. */
- if (ts->type == BT_CHARACTER && ts->u.cl && ts->u.cl->length)
- gfc_expr_check_typed (ts->u.cl->length, gfc_current_ns, true);
+ if (ts.type == BT_CHARACTER && ts.u.cl && ts.u.cl->length)
+ gfc_expr_check_typed (ts.u.cl->length, gfc_current_ns, true);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 248f933ac1e..a98e70164c0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/67525
+ * gfortran.dg/pr67525.f90: New test.
+
2015-09-25 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/55603
diff --git a/gcc/testsuite/gfortran.dg/pr67525.f90 b/gcc/testsuite/gfortran.dg/pr67525.f90
new file mode 100644
index 00000000000..35f716dc6b5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr67525.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! PR fortran/67525
+! Code contributed by Gerhard Steinmetz
+!
+real function f(x)
+ select type (x) ! { dg-error "shall be polymorphic" }
+ end select
+end function f
+
+real function g(x)
+ select type (x=>null()) ! { dg-error "shall be polymorphic" }
+ end select
+end function g
+
+subroutine a(x)
+ select type (x) ! { dg-error "shall be polymorphic" }
+ end select
+end subroutine a