From 786773d4c12fd78e94f58193ff303cba19ca1b19 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sat, 28 Sep 2024 22:29:56 +0200 Subject: Implement FINDLOC for UNSIGNED. gcc/fortran/ChangeLog: * check.cc (intrinsic_type_check): Handle unsigned. (gfc_check_findloc): Likewise. * gfortran.texi: Include FINDLOC in unsigned documentation. * iresolve.cc (gfc_resolve_findloc): Use INTEGER version for UNSIGNED. gcc/testsuite/ChangeLog: * gfortran.dg/unsigned_33.f90: New test. --- gcc/fortran/iresolve.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/iresolve.cc') diff --git a/gcc/fortran/iresolve.cc b/gcc/fortran/iresolve.cc index 5a1e0a6..9fb2212 100644 --- a/gcc/fortran/iresolve.cc +++ b/gcc/fortran/iresolve.cc @@ -1819,6 +1819,7 @@ gfc_resolve_findloc (gfc_expr *f, gfc_expr *array, gfc_expr *value, int i, j, idim; int fkind; int d_num; + bt type; /* See at the end of the function for why this is necessary. */ @@ -1897,9 +1898,15 @@ gfc_resolve_findloc (gfc_expr *f, gfc_expr *array, gfc_expr *value, gfc_convert_type_warn (back, &ts, 2, 0); } + /* Use the INTEGER library function for UNSIGNED. */ + if (array->ts.type != BT_UNSIGNED) + type = array->ts.type; + else + type = BT_INTEGER; + f->value.function.name = gfc_get_string (PREFIX ("%s%d_%c%d"), name, d_num, - gfc_type_letter (array->ts.type, true), + gfc_type_letter (type, true), gfc_type_abi_kind (&array->ts)); /* We only have a single library function, so we need to convert -- cgit v1.1