From 9ef0be7d2364939e58307b0a53ec91fa4d5fdac8 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Mon, 7 Sep 2020 09:36:29 +0200
Subject: [PATCH] fortran: Fix arg types of _gfortran_is_extension_of

gcc/fortran/ChangeLog

	* resolve.c (resolve_select_type): Provide a formal arg list.

(cherry picked from commit a502683de1f036b5f8b4e483bd9f5a45be73382e)
Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
---
 gcc/fortran/resolve.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git gcc/fortran/resolve.c gcc/fortran/resolve.c
index dc127abeb64..906367c66b0 100644
--- gcc/fortran/resolve.c
+++ gcc/fortran/resolve.c
@@ -9674,6 +9674,12 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
 	  new_st->expr1->value.function.actual->next = gfc_get_actual_arglist ();
 	  new_st->expr1->value.function.actual->next->expr = gfc_get_variable_expr (st);
 	  new_st->expr1->value.function.actual->next->expr->where = code->loc;
+	  /* Set up types in formal arg list.  */
+	  new_st->expr1->value.function.isym->formal = XCNEW (gfc_intrinsic_arg);
+	  new_st->expr1->value.function.isym->formal->ts = new_st->expr1->value.function.actual->expr->ts;
+	  new_st->expr1->value.function.isym->formal->next = XCNEW (gfc_intrinsic_arg);
+	  new_st->expr1->value.function.isym->formal->next->ts = new_st->expr1->value.function.actual->next->expr->ts;
+
 	  new_st->next = body->next;
 	}
 	if (default_case->next)
-- 
2.42.1

