Landing: 1904b9207203

Project / Subsystem

gcc / fortran

Date

2026-05-07

Author

Harald Anlauf

Commit

1904b9207203bbe45d6ce6a472d6a0c7e1bbd873

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
fortran
patch_id
commit_hash
1904b9207203bbe45d6ce6a472d6a0c7e1bbd873
source_type
github
headline
Fortran: Fixed automatic deallocation with derived type IO.
tldr
Corrects an issue in Fortran derived type IO that prevented automatic deallocation of local variables by adjusting the function specification.
author
Harald Anlauf
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • fortran
  • dtio
  • memory management
  • bugfix
discussion_id_link
bugzilla_pr
date
2026-05-07T00:00:00.000Z

This commit resolves an issue in the Fortran compiler related to derived type input/output (DTIO). The compiler was incorrectly forcing allocatable instances of derived types used in IO operations to be static, preventing automatic deallocation of local variables. This was due to a misconfiguration in the function specification for _gfortran_transfer_derived, where the IO variable was incorrectly declared as read-only. Changing the specification to indicate write access resolves the problem and allows for proper automatic deallocation. A new test case verifies the fix.