TUESDAY, OCTOBER 20, 2026
fortran
Fortran: Prevent string truncation in gfc_copy_expr.
Fixed Fortran string copying to prevent NUL truncation and invalid reads.
The gfc_copy_expr function in the Fortran front-end could incorrectly truncate strings that contained NUL characters when simplifying TRANSFER. This issue, particularly when the result type was CHARACTER and its physical representation was longer than the source, led to invalid memory reads. The fix ensures that the length of the copied string representation matches the source, preventing truncation and associated memory errors.