This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PR57456 - Handle ALLOCATE with typespec for CLASS
- From: Janus Weil <janus at gcc dot gnu dot org>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Fri, 31 May 2013 11:12:46 +0200
- Subject: Re: [Patch, Fortran] PR57456 - Handle ALLOCATE with typespec for CLASS
- References: <51A64CB9 dot 3030002 at net-b dot de> <51A64D79 dot 7010108 at net-b dot de>
>> Currently, ALLOCATE ignores the typespec for arrays. Such that:
>> ALLOCATE (t2 :: var(5))
>> will allocate as much memory as the base type requires instead of using as
>> much as "t2" does.
>>
>>
>> I explicitly exclude characters as it otherwise will fail for
>> allocate_with_typespec_1.f90, which uses:
>> allocate(character :: c1(1))
>> The problem is that gfc_typenode_for_spec will return an array type and
>> not an element type, hence TYPE_SIZE_UNIT won't work. The current version is
>> fine, except for deferred-length strings. To properly handle it, one has to
>> do it as gfortran currently does for scalars. (Best by consolidating the
>> support. See PR.)
>>
>> As I want to work on other things first, I would like to get this in as
>> band aid - until someone has the time to do it properly. (I found it when
>> trying to write a test case for the already submitted final patch.)
>>
>> Build and regtested on x86-64-gnu-linux.
>> OK for the trunk?
Looks good. Thanks for the patch!
Cheers,
Janus