[Bug fortran/68846] Pointer function as LValue doesn't work when the assignment regards a dummy argument.

mirco.valentini at polimi dot it gcc-bugzilla@gcc.gnu.org
Tue Feb 28 21:03:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68846

--- Comment #6 from mirco <mirco.valentini at polimi dot it> ---
Hi all, 
I spent some time today working on this bug. I found a small modification that
allows to build without errors and that seems to work (I did a very preliminary
test).

At the moment I'm working with "gfortran 7.0.1 20170219"

The modification is just:

! ===========================================================================
file: resolve.c
line: 10690

at the end of the function "resolve_ptr_fcn_assign" add the foolowing lines:
!----------------------------------------------------------------------------
(*code)->expr1->symtree->n.sym->attr.dummy = 0;
(*code)->expr1->symtree->n.sym->attr.intent = INTENT_UNKNOWN;
=============================================================================


The reason is that the temporary pointer used to store the result of the
pointer function should never inherit the "dummy" attribute.

Is there any drawback with this modification? I don't know very well the code
of gfortran and for this reason I don't know the possible implications of this
modification.

Regards,
Mirco


More information about the Gcc-bugs mailing list