Commit Message

On Tue, Dec 11, 2012 at 02:29:18PM +0100, Janus Weil wrote:
> 2012/12/11 Jakub Jelinek <jakub@redhat.com>:> > On Tue, Dec 11, 2012 at 12:16:33PM +0100, Janus Weil wrote:> >> Ok, so here is a new patch, updated according to the suggestions of> >> David and Jakub. This now only touches the dotted variables, which are> >> responsible for the AIX trouble. Whether the same prefixing should> >> also be applied in other cases, we can still decide later.> >> > Why are you changing anything in create_function_arglist (PARM_DECLs> > can't ever be TREE_STATIC, and it is compiler internal (plus debug info)> > thing how they are named, no need for any kind of mangling) or> > saved_dovar (again, doesn't seem to be TREE_STATIC)?> >> > Even in gfc_create_string_length you don't need to increase the length> > of the names and obfuscate them if it isn't going to be TREE_STATIC.> > Yes, you're probably right.> > Anyway, I'm out. I don't have the capacities to deal with this right> now (and, frankly, it's not my duty anyway) ...
So, what about this version instead?
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2012-12-11 Jakub Jelinek <jakub@redhat.com>
Janus Weil <janus@gcc.gnu.org>
PR fortran/55636
* gfortran.h (GFC_PREFIX): Define.
* trans-decl.c (gfc_create_string_length): For VAR_DECLs that
will be TREE_STATIC, use GFC_PREFIX to mangle the names.
Jakub

Jakub Jelinek wrote:
> So, what about this version instead?> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?> 2012-12-11 Jakub Jelinek<jakub@redhat.com>> Janus Weil<janus@gcc.gnu.org>>> PR fortran/55636> * gfortran.h (GFC_PREFIX): Define.> * trans-decl.c (gfc_create_string_length): For VAR_DECLs that> will be TREE_STATIC, use GFC_PREFIX to mangle the names.
…
> /* Also prefix the mangled name. */> - if (sym->module)> + if (sym->attr.save || sym->ns->proc_name->attr.flavor == FL_MODULE)> + {> + if (sym->module)> + name = gfc_get_string (GFC_PREFIX ("%s_MOD_%s"), sym->module,> + sym->name);> + else> + name = gfc_get_string (GFC_PREFIX ("%s"), sym->name);> + }> + else if (sym->module)> name = gfc_get_string (".__%s_MOD_%s", sym->module, sym->name);> else> name = gfc_get_string (".%s", sym->name);
Looks mostly okay, however, I fear that for
subroutine foo()
character(len=:), allocatable :: str
allocate(str, stat=istat)
end subroutine foo
compiled with "-fno-automatic", gfortran will still generate the
non-GFC_PREFIX-mangled string.
"-fno-automatic" implies SAVE / static memory and is required by some
old code. Hence, it is unlikely to be used with new code; still,
gfortran should get this right. (Actually, as PR55733 shows, there are
issues beyond the mangling with -fno-automatic for deferred-length
strings/scalar allocatables).
Thus, I wonder whether one should always use GFC_PREFIX. On the other
hand, for scan-tree-dump, it is nice to have a single mangling instead
of 3 different ones. (Though, currently, no scan-tree-dump seems to be
used in this case.)
Hence:
OK with either always using GFC_PREFIX – or with an additional "&&
gfc_option.flag_max_stack_var_size == 0" check and a comment why the
mangling is done.
Tobias

On Tue, Dec 18, 2012 at 04:40:10PM +0100, Tobias Burnus wrote:
> Looks mostly okay, however, I fear that for> > subroutine foo()> character(len=:), allocatable :: str> allocate(str, stat=istat)> end subroutine foo> > compiled with "-fno-automatic", gfortran will still generate the> non-GFC_PREFIX-mangled string.
That doesn't compile:
Error: Allocate-object at (1) with a deferred type parameter requires either a type-spec or SOURCE tag or a MOLD tag
Where would be TREE_STATIC set on the length variable with -fno-automatic,
and on which testcase?
Jakub