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] PR24789 - ICE when assigning to array of strings


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


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