https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30372
--- Comment #19 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Sun, Jul 19, 2020 at 02:42:24PM +0000, arjen.markus895 at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30372 > > --- Comment #17 from Arjen Markus <arjen.markus895 at gmail dot com> --- > As UMASK has two arguments, should it be possible to combine integer arguments > of different kinds? That is: > > integer(kind=1) :: mask > integer(kind=8) :: old > > call umask( mask, old ) > > (Probably a bit overdoing it, but I guess it should be documented either way) > Comment 12 makes UMASK a generic function. Comment 13 makes UMASK a generic subroutine. The patch for the generic subroutine UMASK converts MASK to integer(4) and, if present, OLD to integer(4). It then creates a call to _gfortran_umask_i4_sub. Note umask(2) takes a mode_t in C, which at least on FreeBSD is an unsigned int. So, in a sense it does not matter if the kind types differ for MASK and OLD. OTOH, the Fortran standard for most intrinsic routines require types to be the same. gfortran should probably have a check for the same type. Index: gcc/fortran/check.c =================================================================== --- gcc/fortran/check.c (revision 280157) +++ gcc/fortran/check.c (working copy) @@ -7230,10 +7230,7 @@ gfc_check_umask_sub (gfc_expr *mask, gfc_expr *old) if (old == NULL) return true; - if (!scalar_check (old, 1)) - return false; - - if (!type_check (old, 1, BT_INTEGER)) + if (!same_type_check (mask, 0, old, 1, false)) return false; return true;