Dear Andre,
The patch causes an ICE for the test gfortran.dg/unlimited_polymorphic_1.f03:
f951: internal compiler error: in gfc_add_component_ref, at fortran/class.c:236
f951: internal compiler error: Abort trap: 6
gfc: internal compiler error: Abort trap: 6 (program f951)
Abort
Reduced test for which the ICE is triggered by ‘len(w)'
MODULE m
contains
subroutine bar (arg, res)
class(*) :: arg
character(100) :: res
select type (w => arg)
type is (character(*))
write (res, '(I2)') len(w)
end select
end subroutine
END MODULE
Note that with your patch at
https://gcc.gnu.org/ml/fortran/2014-08/msg00022.html, I get the same ICE for
the Mikael’s test at https://gcc.gnu.org/ml/fortran/2014-08/msg00055.html
(before your patch for pr60255, it used to give a wrong length: 80 instead of
20 AFAICR).
Note that the assert at fortran/class.c:236 is also triggered for pr61115.
Thanks for working on these issues,
Dominique
>> On 8 December 2014 at 18:38, Andre Vehreschild <[email protected]> wrote:
>> Hi all,
>>
>> please find attached a more elaborate patch for pr60255. I totally agree that
>> my first attempt was just scratching the surface of the work needed.
>>
>> This patch also is *not* complete, but because I am really new to gfortran
>> patching, I don't want to present a final patch only to learn then, that I
>> have
>> violated design rules, common practice or the like. Therefore please comment
>> and direct me to any sources/ideas to improve the patch.
>>
>> Topic:
>> The pr 60255 is about assigning a char array to an unlimited polymorphic
>> entity. In the comments the concern about the lost length information is
>> raised. The patch adds a _len component to the unlimited polymorphic entity
>> (after _data and _vtab) and adds an assignment of the string length to _len
>> when a string is pointer assigned to the unlimited poly entity. Furthermore
>> is
>> the intrinsic len(unlimited poly pointing to a string) resolved to give the
>> _len component.
>>
>> Yet missing:
>> - assign _len component back to deferred char array length component
>> - transport length along chains of unlimited poly entities, i.e., a => b; c
>> =>
>> a where all objects are unlimited poly and b is a string.
>> - allocate() in this context
>>
>> Patch dependencies:
>> none
>>
>> Comments, concerns, candy welcome!
>>
>> Regards,
>> Andre