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

--- Comment #2 from Steve Kargl <kargl at gcc dot gnu.org> ---
(In reply to Damian Rouson from comment #1)
> Switching from `error stop` to `stop` yields the same error message.
> 
> The workaround is to assign the function result to a variable and then use
> the variable as the stop code.

There are other workaround.  Here's one.

  implicit none
   character(len=1), external :: character_stop_code
   error stop character_stop_code()
   contains
end 

function character_stop_code()
   character(len=1) character_stop_code
   character_stop_code = "a"
end function

The problem is the test for integer or character type occurs
before the contained function is resolved.  In the above, the
functions return type is known before 'error stop' is parsed.
Putting character_stop_code() in a module and using the module
may also be a workaround.

Reply via email to