This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran, F03] PR 40996: Allocatable Scalars


2009/8/30 Steve Kargl <sgk@troutmask.apl.washington.edu>:
> On Sun, Aug 30, 2009 at 01:00:21PM +0200, Janus Weil wrote:
>>
>> > It does regtest OK but it needs
>> > possible error conditions checking out; for example
>> >
>> > ?allocate(non-existent-symbol :: x(2))
>> > ? ? ? ? ? ? ? ? ? 1
>> > Error: Allocate-object at (1) is not a nonprocedure pointer or an
>> > allocatable variable
>> >
>> > Which is OK from the perspective of it producing an error but might
>> > perplex the uninitiated:-)
>>
>> I extended your patch a bit so that it gives a better error message
>> for this example. It also rejects abstract types in the ALLOCATE
>> statement. What is still missing is a check if the type in the
>> ALLOCATE stmt is compatible with the type of the allocate-object (i.e.
>> C624, see my test case).
>>
>
> Which type? ?For the intrinsic types, the checking of compatibility
> was in my original type.

Yeah, sure. This is about derived types, where you have two
possibilities AFAICS:
1) If the object which is being allocated was declared with TYPE, the
ALLOCATE statement must have the same type (or omit it).
2) If the object which was declared with CLASS, the ALLOCATE statement
may have any type which is a descendant of the original type.

Btw: Do we have a function which checks if one type is an extension
(direct or indirect) of another, or do I have to invent this?

Cheers,
Janus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]