Dear All, I've committed the attached patch for a regression on some 32-bit targets as obvious after a hint by Mikael and verification of the fix by Rainer in the PR as r16-6322-gabf3f0b24c4d07 .
Thanks, Harald
From abf3f0b24c4d07649266371c0f8f9625dff58cd3 Mon Sep 17 00:00:00 2001 From: Harald Anlauf <[email protected]> Date: Sun, 21 Dec 2025 23:03:28 +0100 Subject: [PATCH] fortran: fix testsuite regression for gfortran.dg/value_9.f90 [PR123201] Commit r16-3499 introduced a regression on targets where truncation of a string argument passed to a CHARACTER(len=1),VALUE dummy argument missed the special treatment needed for passing single characters. PR fortran/123201 gcc/fortran/ChangeLog: * trans-expr.cc (conv_dummy_value): Convert string of length 1 to a single character for passing as actual argument. --- gcc/fortran/trans-expr.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index b549a62880e..20f74927153 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -6654,6 +6654,14 @@ conv_dummy_value (gfc_se * parmse, gfc_expr * e, gfc_symbol * fsym, e->value.character.string); parmse->string_length = build_int_cst (gfc_charlen_type_node, flen); + if (flen == 1) + { + tree slen1 = build_int_cst (gfc_charlen_type_node, 1); + gfc_conv_string_parameter (parmse); + parmse->expr = gfc_string_to_single_character (slen1, parmse->expr, + e->ts.kind); + } + /* Indicate value,optional scalar dummy argument as present. */ if (fsym->attr.optional) vec_safe_push (optionalargs, boolean_true_node); -- 2.51.0
