# Help working around finalization issue

**URL:** <https://fortran-lang.discourse.group/t/help-working-around-finalization-issue/9690>\
**Category:** GNU\
**Created:** [May 9, 2025, 4:33pm UTC](https://fortran-lang.discourse.group/t/help-working-around-finalization-issue/9690 "2025-05-09T16:33:49Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![davidpfister](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/davidpfister/32/3949_2.png) [@davidpfister](https://fortran-lang.discourse.group/u/davidpfister)\
**Post date:** [May 13, 2025, 2:42pm UTC](https://fortran-lang.discourse.group/t/help-working-around-finalization-issue/9690/9 "2025-05-13T14:42:04Z")

</div>

Sure,  
here is a cases were PDT are used to create dynamic arrays of various types ([fortiche/src/collections/src/list/intrinsic\_list.f90 at 2be73be10fc76d26d65f6f0459e1954613b5ea38 · davidpfister/fortiche · GitHub](https://github.com/davidpfister/fortiche/blob/2be73be10fc76d26d65f6f0459e1954613b5ea38/src/collections/src/list/intrinsic_list.f90#L52)). From my experience, they work fine when you use the `kind` parameter but are very buggy when you use the `length` parameter. PDT with `kind` could be useful for refactoring @amasaki203 [unsigned integer](https://github.com/ShinobuAmasaki/uint-fortran) library for instance.

Things start to get messy when you want to use [assumed type PDT](https://web.archive.org/web/20230322185106/https://www.pgroup.com/blogs/posts/f03-oop-part3.htm) as dummy arguments. Every time I tried, gfortran could not resolve the procedure signature.

Even with compilers that correctly implements the `length` parameter, the performance do not seem to be there: [Working with parameterised derived type containing array of parameterised derived type - #18 by nncarlson](https://fortran-lang.discourse.group/t/working-with-parameterised-derived-type-containing-array-of-parameterised-derived-type/5823/18)

> [@Working with parameterised derived type containing array of parameterised derived type](https://fortran-lang.discourse.group/t/working-with-parameterised-derived-type-containing-array-of-parameterised-derived-type/5823/18):
>
> It worked just fine with the ifort compiler. However it was much, much slower – something like 8x slower. I have no clue why. But I recalled an email exchange I had with a NAG compiler developer many years ago, who strongly discouraged me from using length type parameters because of something intrinsic to them would necessarily make them relatively slow. I don’t recall the details now. If a compiler developer reading this could shed some light on this, that would be great.

I experienced it myself when I tried to write a version of [Differentia](https://github.com/Nicholaswogan/Differentia) with PDT rather than allocatables. The performances were disappointing to say the least.

---

_[View the full topic](https://fortran-lang.discourse.group/t/help-working-around-finalization-issue/9690)._
