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

            Bug ID: 87851
           Summary: [8/9 Regression] Wrong return type for len_trim
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

Looking at PR 87711, it struck me that we have a type mismatch
between the library version of len_trim and what the compiler
generates.

The library side has, in string_intrinsics_inc.c,

/* The length of a string not including trailing blanks.  */

gfc_charlen_type
string_len_trim (gfc_charlen_type len, const CHARTYPE *s)

and the compiler generates for

program main
  character(len=3) :: c
  c = 'a  '
  print *,len_trim(c)
end program main

   _gfortran_st_write (&dt_parm.0);
    {
      integer(kind=4) D.3818;

      D.3818 = (integer(kind=4)) _gfortran_string_len_trim (3, &c);
      _gfortran_transfer_integer_write (&dt_parm.0, &D.3818, 4);
    }
    _gfortran_st_write_done (&dt_parm.0);

on a 64-bit system.

Reply via email to