This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: [Patch, Fortran, 4.5 Regression] PR 40822: Internal compiler error when Fortran intrinsic LEN referenced before explicit declaration


2009/7/23 Tobias Burnus <burnus@net-b.de>:
> Janus Weil wrote:
>> here is a close-to-obvious two-line patch, fixing a regression which
>> was introduced by one of my earlier ProcPtr patches.
> I have not fully thought about the patch. But if I read
>
> + ? ? ?if (formal_arg->sym->ts.type == BT_CHARACTER)
> + ? ? ? formal_arg->sym->ts.cl = gfc_get_charlen ();
> +
>
>
> I wonder whether this does not just allocate space for the character
> length data, without actually properly initializing the struct.

I guess the cl structure here is at least initialized in the sense
that it is zeroed, and there is no junk data in there.

The reason that I don't initialize cl->length is that
"cl->length==NULL" is equivalent to an assumed-length string, right?
And what i do here is create charlen structures for formal args of
intrinsic functions, which usually are assumed-length. At I least I
think the gfc_intrinsic_arg structures do not get a charlen anywhere.

However, I forgot another thing: To add the charlen to a namespace,
more precisely to a ns->cl_list (which probably creates a memory leak,
since the charlen never gets deallocated). Will post an updated patch
in a minute ...

Cheers,
Janus


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