[PATCH, Fortran, pr78395, v1] [OOP] error on polymorphic assignment

Andre Vehreschild vehre@gmx.de
Fri Nov 18 17:00:00 GMT 2016


Hi all,

attached patch fixes the issue which was given by nesting calls to typebound
procedures. The expression of the inner typebound procedure call was resolved
correctly, but in the case of it's having a class type the ref-list was
discarded. Leaving the list of references untouched, resolves the wrong
error-message and generates correct code.

When checking the shortened example in comment #3 one gets a segfault, because
v6 is not allocated explicitly. The initial example made sure, that v6 was
allocated. Reading through the standard, I did not find, whether the
auto-allocation is applicable here. I therefore have extended the testcase by
an allocate(v6). Dominique pointed out, that there are already some prs for
adding an on-demand -fcheck=something runtime check for not allocated objects.
But that does not solve the question, whether v6 should be auto-allocated
when assigned by a typebound-procedure (ifort and cray need v6 allocated do,
i.e., they don't auto-allocate). Btw, when using the in gcc-7 available
polymorphic assign, then v6 is actually auto-allocated and the program runs
fine. So what are your opinions on the auto-allocation issue?

This patch fixes the wrong error messages in both gcc-7 and gcc-6.
Bootstraped and regtested on x86_64-linux/F23 for gcc-7 and -6. Ok for trunk
and gcc-6?

Regards,
	Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr78395_1.clog
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161118/086e2d3b/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr78395_1.patch
Type: text/x-patch
Size: 2217 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161118/086e2d3b/attachment.bin>


More information about the Fortran mailing list