[Patch, fortran] PR99124 - [9/10/11 Regression] ICE in gfc_get_class_from_expr, at fortran/trans-expr.c:541
Paul Richard Thomas
paul.richard.thomas@gmail.com
Tue Feb 23 17:39:20 GMT 2021
Hi Tobias,
→ Can you add also a testcase that which triggers the error message you
> see in the unpatched class_assign_4.f90?
> > I was unable to find a way to use a typebound operator with a polymorphic
> > result
> I am confused – the attach testcase does seem to work fine with current
> GCC. (And if we don't have such a testcase, it should be added.)
> Can you elaborate?
>
The polymorphic result must be allocatable or pointer for the dynamic type
to be transmitted. This means that the function cannot be elemental. If the
result of the non-elemental function is an array, gfc responds with:
"Error: Passed-object dummy argument of ‘f’ at (1) must be scalar"
If the procedure declaration is made nopass, the response is:
"Type-bound operator at (1) cannot be NOPASS"
See the attached elemental_result_2.f90, which tests the new error message.
>From these points, I concluded that a typebound operator could not provide
the required polymorphic array result. If I am wrong about this, please let
me know and I will change the patch accordingly.
The interface operator does not have these constraints and so was
implemented in class_assign_4.f90.
The patch itself LGTM, except for testing the newly shown error message
> and for the confusion about the type-bound operator.
>
All done. Note that the patch has changed slightly in resolve.c because
(1) it was the wrong version and (2) it sporadically segfaulted at line
13240.
Thanks
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elemental_result_2.f90
Type: text/x-fortran
Size: 996 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210223/ba00ee44/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 2978 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210223/ba00ee44/attachment-0003.bin>
More information about the Gcc-patches
mailing list