Ref: https://gcc.gnu.org/pipermail/fortran/2026-February/063551.html
See attached.
Awaiting approval.
From 276d24b5d998377213dd3b257f7d3f4b216615ac Mon Sep 17 00:00:00 2001
From: Andre Vehreschild <[email protected]>
Date: Fri, 6 Feb 2026 15:01:52 +0100
Subject: [PATCH] Fortran: Ensure constant strings are sent correctly to caf.
gcc/fortran/ChangeLog:
* trans-intrinsic.cc (conv_caf_send_to_remote): Fix treating constant
char arrays when used in coarray sends.
---
gcc/fortran/trans-intrinsic.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc
index cacefa3942b..578851e1b0b 100644
--- a/gcc/fortran/trans-intrinsic.cc
+++ b/gcc/fortran/trans-intrinsic.cc
@@ -1486,7 +1486,8 @@ conv_caf_send_to_remote (gfc_code *code)
gfc_init_se (&rhs_se, NULL);
if (rhs_expr->rank == 0)
{
- rhs_se.want_pointer = rhs_expr->ts.type == BT_CHARACTER;
+ rhs_se.want_pointer = rhs_expr->ts.type == BT_CHARACTER
+ && rhs_expr->expr_type != EXPR_CONSTANT;
gfc_conv_expr (&rhs_se, rhs_expr);
gfc_add_block_to_block (&block, &rhs_se.pre);
opt_rhs_desc = null_pointer_node;
--
2.53.0