- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a question regarding the interface of the final subroutines. According to the Fortran 2003 standards, you can have multiple final bindings, with the following restriction: any two final subroutines for a type must differ in the rank of kind type paramters of the dummy argument. The same final subroutine may not be specified twice.
In the attached small fortran file, I have created an type:
TYPEDerivedQuantityType INTEGER,DIMENSION(:),POINTER::Unit=>null() CONTAINS FINAL::FreeDerivedQuantity FINAL::FreeDerivedQuantities
...
ENDTYPEDerivedQuantityType
Where the interface only differs in rank:
- FreeDerivedQuantities(:)
- FreeDerivedQuantity
This type is part of another type:
TYPEQuantityType TYPE(DerivedQuantityType),DIMENSION(:),POINTER::DerivedQuantity=>null()
CONTAINS
...
ENDTYPEQuantityTypeI use the generic assignment (=) for the derived type (see also the attached file),
NewQuantityType%DerivedQuantity(1)=OldQuantityType%DerivedQuantity(1) The generic assignment has an intent(out) attribute on the DerivedQuantity. The compiler then will deallocate the header argument when the routine is called.
I would have assumed that it is calling the FreeDerivedQuantity routine. However, when I debug the session, I notice that it does use the FreeDerivedQuantities routine, resulting in an access violation.
Does anyone has an explanation for this behavior?
Kind Regards,
Dirk van Meeuwen
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This has been fixed for a release later this year.
![](/skins/images/98E68944C1FF703B8AC50091329B92AF/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page