Does the result change if the function
module function xbsf_get_error_string(ierr) result(str)
integer(xbsf_int_t), value :: ierr
character(len = :), allocatable :: str
is replaced by a subroutine (such that str
is passed as an actual argument)? Also, in the function case, does it work correctly if the result variable is declared as a character string of fixed size (say, character(100) :: str
)? I remember I saw a similar issue for allocatable strings in the context of recursive functions or OpenMP. Because it might also affect other cases, I think it would be great if a reproducible code example could be created (e.g. for submission to the gfortran issue site).
- Integer or real to character string: bug with gfortran with OpenMP? - #6 by martin
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113797
(the last comment above seems to mention a potential bug) - Automatic allocation of string in recursive function unexpected result [issue with `ifx` and bug in `gfortran` and `nvfortran`] - #11 by eelis