Fix coarray deallocation placement before END TEAM
Ensures coarray deallocation occurs correctly before END TEAM statements.
This commit fixes an ICE (Internal Compiler Error) in the Fortran compiler related to coarray deallocation. It modifies the deallocate_allocated_coarrays function to correctly locate the END TEAM statement by traversing the team block’s code list from the head. The guarded deallocation is then spliced in front of the END TEAM statement, ensuring proper execution order.
In Details
The Fortran frontend's handling of coarrays and END TEAM statements caused an ICE when attempting to deallocate coarrays. This patch corrects st.cc by walking the team block's code list from the head to find the EXEC_END_TEAM statement and inserts the guarded deallocation logic prior to it, resolving the compiler error.
- Coarray
- A Fortran language feature that provides built-in support for parallel programming, allowing code to communicate across different processing units.
- END TEAM
- A Fortran statement that marks the end of a team block in coarray programming, signifying the end of a scope for parallel execution.
- ICE
- Internal Compiler Error, a fatal error that occurs when the compiler encounters an unexpected condition during compilation.
- Team block
- A construct in Fortran coarray programming that defines a group of processing units that can execute concurrently.