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

--- Comment #2 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #1)
> Workaround 3.
> 
>   Explicitly give entities the SAVE attribute whereby your
>   testfunc() becomes
> 
>   function testfunc(string) result(res)
>     character(:), allocatable, save :: res
>     character(*), intent(in) :: string
>     res = string
>   end function testfunc

That is explicit standard violation.

Adding a blank SAVE statement in the function body seems to work as expected,
so a user who believes in -fno-automatic may call it a gfortran bug.

Personally, I'd recommend:

Workaround 4.

  Never use -fno-automatic.

Reply via email to