This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch/gfortran] Fix for PR16939
- From: THOMAS Paul Richard 169137 <prthomas at drfccad dot cea dot fr>
- To: "'tobias dot schlueter at physik dot uni-muenchen dot de'" <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Tue, 10 May 2005 14:31:48 +0200
- Subject: Re: [Patch/gfortran] Fix for PR16939
Tobi,
>> I thought to do the same. However, I am not sure that it is clearer. More
>> importantly, I decided to ring-fence the scalar case because I think that
>> dummy argument arrays of character pointers need the same treatment. They
>> are broken elsewhere, such that I cannot even get to this point usefully.
> They will still need an array descriptor, won't they? So I don't think
this
> will be the case, as the code there is meant to do the correct thing with
> array descriptors IIUC.
The array descriptor is what is passed but it needs dereferencing for
pointer, dummy, character arrays. Doing so fixes PR18689, in addition
PR16939.
>> How about I make it leaner and meaner once I have a clear view of what to
do
>> with arrays?
> I don't understand how pushing this backwards
I am not pushing backwards! Anyway, I am now happy to combine the ifs
appropriately. I'll do it tonight and resubmit the patch as a fix for both
PRs.
It will be along the lines:
/* Dereference non-character scalar and pointer
dummy arguments. HOW DO I INDENT THIS?*/
if (sym->attr.dummy
&& ((sym->ts.type != BT_CHARACTER
&& !sym->attr.dimension)
|| (sym->attr.pointer
&& sym->ts.type == BT_CHARACTER)))
se->expr = gfc_build_indirect_ref (se->expr);
/* Dereference pointer variables.
TODO - sort out attr.function and attr.result
for characters. */
if ((sym->attr.pointer || sym->attr.allocatable)
&& (sym->attr.dummy
|| sym->attr.result
|| sym->attr.function
|| !sym->attr.dimension)
&& sym->ts.type != BT_CHARACTER)
se->expr = gfc_build_indirect_ref (se->expr);
I believe that some of the other character PRs will be fixed by going
through the logic of the second block, as the TODO indicates.
Paul T