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] PR41582 allocate patch for CLASS


Janus Weil wrote:
>> a) A constraint for ALLOCATE (class with abstract base type):
>> "C625 (R623) If any allocate-object is unlimited polymorphic or
>>  is of abstract type, either type-spec or SOURCE= shall appear."
>>     
> When checking for the 'abstract' attribute in resolve_allocate_expr,
> one has to determine the attributes of the given expression. Couldn't
> this be done via 'gfc_expr_attr' or 'gfc_variable_attr', or is there
> something special about it? Similar things happen also in
> resolve_deallocate_expr, and it looks quite kludgy ...
>
>   
I think one could use these functions (I was not aware of them). But I
think one should do so in a separate patch - and one needs to add the
attr.abstract check to gfc_*_attr.
Shall I open a cleanup PR?

I have committed the current patch as Revision 152601.

>> allocate(..., SOURCE=<class>)
>>
>>     
> 2) Add a 'size' field to the class container. Advantage: Cleaner code,
> better performance. Downside: Larger class container. (Ideally this
> field could be in the vtable, so that it does not need to be stored
> for each class variable, but only once.)
>   

At the end, I would like to get rid of the class container and simply
use an array descriptor which contains the necessary fields. It already
contains most information needed for arrays and with the current
development (CLASS(*), TR 29113, [scalar] coarrays) it will also be used
for scalars. Thus having everything at one place makes sense. I think
one also needs the size of one element, cf also
http://gcc.gnu.org/wiki/ArrayDescriptorUpdate, which cites the TR 29113
draft which has:

size_t        elem_len;           /* length of one element, in bytes             */


I think that field can be commonly found in array descriptors. By the
way, Cray has seemingly a field uint32 d_type_idx for the run-time type
table in the array descriptor. (Regarding TR 29113: There will be a
discussion/review on current draft in February, cf.
ftp://ftp.nag.co.uk/sc22wg5/N1751-N1800/N1794.txt. My goal would be
still to have something like that as internal format in gfortran. TR
29113 might change if Nick Maclaren has a convincing (pre)draft at that
point. But at least we will know more around the time Stage1 begins.)

Tobias


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