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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Cross ref: The issue came up at:
https://gcc.gnu.org/ml/fortran/2019-07/msg00055.html

Actually, at least the 'static' line only appears for 'containes' procedures.

If they are generated ('gfc_generate_contained_functions'), there is a call to
'create_function_arglist'.

In that call, it starts with (in trans-decl.c):
2386      fndecl = sym->backend_decl;

And if one dumps that three, one has:
  arg-types <tree_list 0x7ffff1f747f8 value <integer_type 0x7ffff1f3f5e8
integer(kind=4)>
      chain <tree_list 0x7ffff1f3eac8 value <void_type 0x7ffff1f3ff18 void>>>>

Namely, the hidden argument is missing. However, later in that function
(create_function_arglist), one has:
   hidden_arglist = chainon (hidden_arglist, tmp);
...
    arglist = chainon (arglist, hidden_arglist);
  DECL_ARGUMENTS (fndecl) = arglist;


My feeling is that the 'static' line is generated based on the original
backend_decl - while the update comes later - too late.


NOTE: For a dummy argument
   character(len=6), value, optional :: x
the hidden argument is added. (Although, in this case, the hidden argument is
not needed as the string length has to be fixed.)

Reply via email to