[PATCH 4/22] Coarray caf_shmem final patch set

Jerry D <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
Ref: https://gcc.gnu.org/pipermail/fortran/2026-February/063551.html

See attached.

Awaiting approval.
caf_shmem-4-of-22.patch (text/x-patch, 2.2 KB)
From 339dc9b6dbac718f0e3480dff303f98ff45b5750 Mon Sep 17 00:00:00 2001
From: Andre Vehreschild <[email protected]>
Date: Wed, 18 Jun 2025 09:23:32 +0200
Subject: [PATCH] Fortran: Fix signatures of coarray API and caf_single.

The teams argument to some functions was marked as unused in the header.
With upcoming caf_shmem this is incorrect, given the mark is repeated in
caf_single.

libgfortran/ChangeLog:

	* caf/libcaf.h (_gfortran_caf_failed_images): Team attribute is
	used now in some libs.
	(_gfortran_caf_image_status): Same.
	(_gfortran_caf_stopped_images): Same.
	* caf/single.c (caf_internal_error): Use correct printf function
	to handle va_list.
---
 libgfortran/caf/libcaf.h | 9 +++------
 libgfortran/caf/single.c | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/libgfortran/caf/libcaf.h b/libgfortran/caf/libcaf.h
index 06617a142b8..022ac5c365f 100644
--- a/libgfortran/caf/libcaf.h
+++ b/libgfortran/caf/libcaf.h
@@ -175,12 +175,9 @@ void _gfortran_caf_event_post (caf_token_t, size_t, int, int *, char *, size_t);
 void _gfortran_caf_event_wait (caf_token_t, size_t, int, int *, char *, size_t);
 void _gfortran_caf_event_query (caf_token_t, size_t, int, int *, int *);
 
-void _gfortran_caf_failed_images (gfc_descriptor_t *,
-				  caf_team_t * __attribute__ ((unused)), int *);
-int _gfortran_caf_image_status (int, caf_team_t * __attribute__ ((unused)));
-void _gfortran_caf_stopped_images (gfc_descriptor_t *,
-				   caf_team_t * __attribute__ ((unused)),
-				   int *);
+void _gfortran_caf_failed_images (gfc_descriptor_t *, caf_team_t *, int *);
+int _gfortran_caf_image_status (int, caf_team_t *);
+void _gfortran_caf_stopped_images (gfc_descriptor_t *, caf_team_t *, int *);
 
 void _gfortran_caf_random_init (bool, bool);
 
diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c
index 7e02dff25d8..43c83e65ec4 100644
--- a/libgfortran/caf/single.c
+++ b/libgfortran/caf/single.c
@@ -129,7 +129,7 @@ caf_internal_error (const char *msg, int *stat, char *errmsg,
       *stat = 1;
       if (errmsg_len > 0)
 	{
-	  int len = snprintf (errmsg, errmsg_len, msg, args);
+	  int len = vsnprintf (errmsg, errmsg_len, msg, args);
 	  if (len >= 0 && errmsg_len > (size_t) len)
 	    memset (&errmsg[len], ' ', errmsg_len - len);
 	}
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.