This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran, patch] PR 23675: Character function of module-variable length
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Erik Edelmann <erik dot edelmann at iki dot fi>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 02 Jan 2006 11:57:19 +0100
- Subject: Re: [gfortran, patch] PR 23675: Character function of module-variable length
- References: <20060102020723.GA6562@acclab.helsinki.fi>
Erik Edelmann wrote:
> Here's a patch for PR 23675. The problem is in short this: When
> translating the call to the function IntToChar2 in the code
...
> we will call gfc_get_symbol_decl() (in trans-decl.c) for the
> symbol of maxStringLength. Since maxStringLength hasn't been
> (explicitely) referenced in 'program test', it doesn't have
> sym->attr.referenced set, which is why we crash at the line
>
> gcc_assert (sym->attr.referenced);
>
> in gfc_get_symbol_decl(). My solution is to, from trans-expr.c
> (gfc_conv_function_call), traverse the expression tree of the
> length of the function result, and mark all variables we find as
> referenced.
Although I see there are a few places in trans*.c where sym->attr.referenced
is set, I still think you should do this earlier, specifically the recently
added function resolve_charlen or one of the constant folders seems more
appropriate.
- Tobi
:REVIEWMAIL:
> 2006-01-02 Erik Edelmann <eedelman@gcc.gnu.org>
>
> fortran/PR 23675
> * expr.c (gfc_expr_set_symbols_referenced): New function.
> * gfortran.h: Add a function prototype for it.
> * trans-expr.c (gfc_conv_function_call): Use it.
>
>
> 2006-01-02 Erik Edelmann <eedelman@gcc.gnu.org>
>
> fortran/PR 23675
> gfortran.dg/char_result_11.f90: New.