https://gcc.gnu.org/g:d6e44135ae257029e762cda93a21669e10175356

commit r16-7733-gd6e44135ae257029e762cda93a21669e10175356
Author: Andre Vehreschild <[email protected]>
Date:   Fri Feb 6 15:01:52 2026 +0100

    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.

Diff:
---
 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 cacefa3942b5..578851e1b0b4 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;

Reply via email to