Le 10/10/2026 à 21:57, Jerry DeLisle a écrit :
See attached patch. A structure constructor that gives an explicit-length allocatable character component an allocatable or deferred-length value ICEs in fold_convert_loc. gfc_trans_subcomponent_assign falls through to its final branch, which fold_converts the value, a pointer to the string, to the component's character type. The patch copies the string with gfc_trans_string_copy instead, which also truncates or blank-pads it to the declared length.The fix is the new BT_CHARACTER branch in gfc_trans_subcomponent_assign in trans-expr.cc; the rest is the new test. The bug was found with the Fujitsu compiler test suite; the test is new. Regression tested on x86_64. OK for mainline? Regards, Jerry --- fortran: [PR125720] ICE assigning an allocatable character to an allocatable component In a structure constructor, copy a value into an explicit-length allocatable character component with gfc_trans_string_copy instead of a scalar fold_convert. Assisted-by: Claude Opus 5.5 PR fortran/125720 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_trans_subcomponent_assign): Use gfc_trans_string_copy for an explicit-length allocatable character component. gcc/testsuite/ChangeLog: * gfortran.dg/structure_constructor_19.f90: New test.
OK.
