[Bug fortran/30372] various intrinsics do not diagnose invalid argument kinds

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jun 20 18:51:24 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30372

--- Comment #12 from kargl at gcc dot gnu.org ---
This makes the UMASK intrinsic function generic by converting the input
argument to default integer kind and calling the relevant libgfortran function.

Index: gcc/fortran/iresolve.c
===================================================================
--- gcc/fortran/iresolve.c      (revision 280157)
+++ gcc/fortran/iresolve.c      (working copy)
@@ -3314,6 +3314,14 @@ gfc_resolve_ucobound (gfc_expr *f, gfc_expr *array, gf
 void
 gfc_resolve_umask (gfc_expr *f, gfc_expr *n)
 {
+  if (n->ts.kind != gfc_default_integer_kind)
+    {
+      gfc_typespec ts;
+      ts.type = BT_INTEGER;
+      ts.kind = gfc_default_integer_kind;
+      gfc_convert_type (n, &ts, 2);
+    }
+
   f->ts.type = BT_INTEGER;
   f->ts.kind = n->ts.kind;
   f->value.function.name = gfc_get_string (PREFIX ("umask_i%d"), n->ts.kind);

The UMASK subroutine is completely broken and requires a much different
approach to fix the problem.  Namely, the subroutine has an optional 
intent(out) argument.  This needs to be dealt with in trans-intrinsic.c


More information about the Gcc-bugs mailing list