This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC, PATCH, fortran] PR fortran/60255 Deferred character length
- From: Dominique d'HumiÃres <dominiq at lps dot ens dot fr>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: Andre Vehreschild <vehre at gmx dot de>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Janus Weil <janus at gcc dot gnu dot org>, Mikael Morin <mikael dot morin at sfr dot fr>, Antony Lewis <antony at cosmologist dot info>
- Date: Tue, 9 Dec 2014 14:16:05 +0100
- Subject: Re: [RFC, PATCH, fortran] PR fortran/60255 Deferred character length
- Authentication-results: sourceware.org; auth=none
- References: <20140817123221 dot 31BBB105 at mailhost dot lps dot ens dot fr> <20141208183840 dot 45364899 at gmx dot de> <CAGkQGiKS59zcpL2-zjK5O=NCWU=iTVdrF7wkPdfuZuy6TbUjgg at mail dot gmail dot com> <49705BAA-594C-476D-BE1C-20E1AFEE7F98 at lps dot ens dot fr>
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 <vehre@gmx.de> 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