# Deallocation on Intrinsic Assignment

**URL:** <https://fortran-lang.discourse.group/t/deallocation-on-intrinsic-assignment/567>\
**Category:** Help\
**Created:** [January 12, 2021, 3:48am UTC](https://fortran-lang.discourse.group/t/deallocation-on-intrinsic-assignment/567 "2021-01-12T03:48:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![drikosev](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@drikosev](https://fortran-lang.discourse.group/u/drikosev)\
**Post date:** [January 12, 2021, 3:48am UTC](https://fortran-lang.discourse.group/t/deallocation-on-intrinsic-assignment/567/1 "2021-01-12T03:48:45Z")

</div>

Hello,

How many finalizations I should expect with these two test cases?

[https://gist.github.com/drikosev/a9e9e8357dbc45aeb02773198069222b#file-realloc\_class\_8.f90](https://gist.github.com/drikosev/a9e9e8357dbc45aeb02773198069222b#file-realloc_class_8-f90)

[https://gist.github.com/drikosev/a9e9e8357dbc45aeb02773198069222b#file-realloc\_class\_9.f90](https://gist.github.com/drikosev/a9e9e8357dbc45aeb02773198069222b#file-realloc_class_9-f90)

The above tests an intrinsic assignment where the LHS has an allocatable  
finalizable component. Both the LHS and RHS have the same RunTime Type.

There are more test cases in that gist. Having feedback for them also would be  
nice. Currently, I’m stuck with the particular two (realloc\_class\_8.f90 & realloc\_class\_9.f90 ).

Regards,  
Ev. Drikos

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [January 19, 2021, 4:29am UTC](https://fortran-lang.discourse.group/t/deallocation-on-intrinsic-assignment/567/2 "2021-01-19T04:29:51Z")

</div>

> [@drikosev](#):
>
> How many finalizations I should expect with these two test cases?

@drikosev ,

Welcome to this Discourse, glad you followed up on the suggestion at comp.lang.fortran and decided to post here as well.

Hopefully you will soon get wider feedback on your inquiry. Note with your cases, you may face the **TL;DR** issue. So anything you can do to make your cases short and sweet might pique more interest.

As to your question, based on my understanding of the current standard, I personally expect the following:

1. `realloc_class_8.f90` case: **4 finalizations** , 2 each for your objects `v` and `x` upon exiting your subroutine `s`.

2. `realloc_class_9.f90` case: **6 finalizations** , 2 each for your objects `v`, `x`, and `w` upon exiting your subroutine `s`.

That is, **no** finalizations during the assignments `v = x` and `v = w` in these 2 cases respectively.

---

<div class="post-metadata">

**Author:** ![drikosev](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@drikosev](https://fortran-lang.discourse.group/u/drikosev)\
**Post date:** [January 19, 2021, 5:50am UTC](https://fortran-lang.discourse.group/t/deallocation-on-intrinsic-assignment/567/3 "2021-01-19T05:50:56Z")

</div>

Hello,

Indeed, the test cases are somewhat long, also not the usual case in the GNU Fortran testsuite. One reason was uncertainty about the results. Another reason may become more obvious by a comment in realloc\_class\_3-f90 (! Check any bug that may execute the finalizer of the RHS).

So I was facing problems of that form. The wrong results of “realloc\_class\_9.f90” may be a new PR in GNU Bugzilla. Your feedback is really appreciated.

Thanks,  
Ev. Drikos
