Landing: b5a3b874b8df

Project / Subsystem

gcc / fortran

Date

2026-06-05

Author

Jerry DeLisle

Commit

b5a3b874b8df2ea2ca82bd97fcd5906f7ebe82d8

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
fortran
patch_id
commit_hash
b5a3b874b8df2ea2ca82bd97fcd5906f7ebe82d8
source_type
github
headline
Implied-do with allocatable-component causes wrong code
tldr
A Fortran compiler bug led to heap-use-after-free errors when reshape-like intrinsics with allocatable components were used in nested implied-do array construc…
author
Jerry DeLisle
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • fortran
  • compiler-bug
  • memory-safety
discussion_id_link
bugzilla_pr
date
2026-06-05T00:00:00.000Z

The Fortran compiler was generating incorrect code for nested implied-do array constructors that used transformational intrinsics like RESHAPE with result types containing allocatable components. This occurred because argument temporaries were being freed before their contents were deep-copied into the result, leading to heap-use-after-free and incorrect runtime values. The fix repositions the block append for freeing temporaries until after the deep-copy loop, ensuring the source data remains live during the copy.