SATURDAY, JULY 11, 2026
fortran
Fortran: Fix compiler crash when recognizing RESULT attribute.
Fixes a compiler internal error (ICE) in function symbol handling related to Fortran's RESULT attribute.
This commit resolves an internal compiler error (ICE) in the Fortran front-end’s gfc_get_symbol_decl function. It updates the symbol declaration resolution to correctly recognize the RESULT attribute, preventing the compiler from misinterpreting a function’s result variable as a host-associated symbol.
In Details
The was_declared function in fortran/resolve.cc incorrectly treated a function's RESULT variable declaration as a potential host-associated symbol. This commit adds recognition for the RESULT attribute to prevent such misinterpretations, fixing PR fortran/78718 and an associated ICE.
For Context
- ICE
- Internal Compiler Error. A condition where the compiler encounters an unrecoverable situation during code analysis or transformation, leading to a crash.
- RESULT attribute
- In Fortran, this attribute is used to name the dummy procedure argument that receives the function's return value, allowing for direct modification of the return value within the function.
- host-associated symbol
- In Fortran, a symbol declared in an intrinsic module or host procedure that is accessible within a contained procedure.