[Bug fortran/105170] New: Invalid finalization in intrinsic assignment
baradi09 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Apr 5 19:58:35 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105170
Bug ID: 105170
Summary: Invalid finalization in intrinsic assignment
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: baradi09 at gmail dot com
Target Milestone: ---
Created attachment 52754
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52754&action=edit
Minimal working example demonstrating the bug
I have a derived type (TWrapper), which has a component with defined
assignment. The containing derived type itself has no defined assignment. Upon
an assignment between two TWrapper instances, a copy of the RHS seems to get
finalized.
The attached MWE demonstrates the problem.
Expected output (as delivered by current Intel and NAG compilers):
RefCounter_final, id:0
TRefCounter_init: id:42
-> Assignment wrapper2 = wrapper
TRefCounter_final, id:0
TRefCounter_final, id:0
TRefCounter_assign: this%id, other%id: 0 42
GFortran output:
TRefCounter_final, id:0
TRefCounter_init: id:42
-> Assignment wrapper2 = wrapper
TRefCounter_final, id:42
TRefCounter_assign: this%id, other%id: 0 42
One finalization seems to be missing. Additionally, the finalized instance
seems to be a copy of the RHS. (A copy, because after the finalization, the RHS
still seems to have kept its id-value...)
More information about the Gcc-bugs
mailing list