This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran, patch] PR 23675: Character function of module-variable length


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]