This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR24789 - ICE when assigning to array of strings
- From: Paul Thomas <paulthomas2 at wanadoo dot fr>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>, patch <gcc-patches at gcc dot gnu dot org>, Janne Blomqvist <jblomqvi at cc dot hut dot fi>
- Date: Fri, 02 Dec 2005 06:45:27 +0100
- Subject: Re: [Patch, fortran] PR24789 - ICE when assigning to array of strings
- References: <438E1BCC.5060303@wanadoo.fr> <20051201120657.GV31785@devserv.devel.redhat.com>
Jakub,
IMHO the type should be created already with the proper length known
(whether it is the hidden _foo length PARM_DECL, or .foo artificial variable
that is initialized in gfc_trans_deferred_vars for CHARACTER variables
and dummy arguments and return vars), or for array types the various
artificial vars initialized in gfc_trans_deferred_vars as well (except
for assumed size arrays which of course don't have known size).
I agree with that; automatic character length, dummy pointer arrays skip
past all the places where they could be locally declared. This is
remarked upon in one or two of the comments in trans_array.c and
trans_decl.c as if it is completely evident that this should be so. They
depend entirely on the actual argument backend declaration, which is
missing the TYPE_UNIT_SIZE exactly because the character length is
automatic.
I guess that the right thing would be to create these variables locally.
For the main part, gfc_trans_deferred_vars is doing the job of
initialising the character length; that was Erik's contribution to the
patch. It is just that the lack of a local declaration means that the
element type size information is missing, so that those parts of
gfortran that still use this segfault.
I can distill non-OpenMP dependent changes from the gomp branch soon
for review if there would be interest in that.
Looking through your patches, I realise that this is something very
important to incorporate into trunk. The incomplete types need to be fixed.
Sorry about the slightly intemperate response last night. I took a silly
amount of spare time to fathom out what was going on and to come up with
a less than perfect patch.
Best regards
Paul