On Tue, Dec 18, 2012 at 08:45:49PM +0100, Tobias Burnus wrote:
> Or one of the examples from PR55733. The example above gives
> currently (w/o your patch):
> 
>   static character(kind=1)[1:.str] * str = 0B;
>   integer(kind=4) .str;

Yeah, that is not a problem for ABI.

> >Where would be TREE_STATIC set on the length variable with -fno-automatic,
> >and on which testcase?
> 
> As written, TREE_STATIC is currently not set (which is a bug, cf.
> PR55733); I think one needs a patch like:
> 
> --- a/gcc/fortran/trans-decl.c
> +++ b/gcc/fortran/trans-decl.c
> @@ -1107,3 +1107,4 @@ gfc_create_string_length (gfc_symbol * sym)
> 
> -      if (sym->attr.save || sym->ns->proc_name->attr.flavor == FL_MODULE)
> +      if (sym->attr.save || sym->ns->proc_name->attr.flavor == FL_MODULE
> +         || gfc_option.flag_max_stack_var_size == 0)
>         TREE_STATIC (length) = 1;

If that is changed, surely the name must be mangled too.
Perhaps best to set a bool variable to the condition and use it in both
places.
  bool static_length = sym->attr.save
                      || sym->ns->proc_name->attr.flavor == FL_MODULE
                      || gfc_option.flag_max_stack_var_size == 0;
  if (static_length)
    {
      name mangling;
    }
  else ...

...
  if (static_length)
    TREE_STATIC (length) = 1;

        Jakub

Reply via email to