Hi Jakub and Richard,

I modified the patch to use -pthread -lcaf_shmem -lrt on all *-linux* based
systems. I have re-tested on the aarch64 with an older glibc and x86_64  with a
recent one. Both regtest w/o errors.

I am wondering, if there shouldn't be some configure or tcl magic to compute
the dependencies for pthreads and shm_open() calls consistently instead of
having to guess them. I mean, libgomp uses pthreads, too. And code duplication
is always a bad idea.

Ok for mainline?

- Andre

On Fri, 13 Mar 2026 15:00:10 +0100
Jakub Jelinek <[email protected]> wrote:

> On Fri, Mar 13, 2026 at 02:51:06PM +0100, Toon Moene wrote:
> > > the linaro CI reported test errors for aarch64 targets. I figured that for
> > > aarch64 on linux the compile flags -pthread and -lrt are needed to link
> > > caf_shmem and produce an executable. The attached patch addresses this by
> > > special case for aarch64-*-linux* similiar to freebsd.  
> > 
> > Amazing - I have been testing caf_shmem for weeks now (first as an
> > additional patch and lately just by bootstrapping the master branch) on
> > aarch64-linux and I have never encountered that problem.
> > 
> > Here's the latest test:
> > 
> > https://gcc.gnu.org/pipermail/gcc-testresults/2026-March/871293.html  
> 
> It is needed only for glibc older than 2.34.  And it isn't arch related,
> just glibc version related.
> 
>       Jakub
> 


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
From ee97911386df811958025dddc584ddd53b3158dc Mon Sep 17 00:00:00 2001
From: Andre Vehreschild <[email protected]>
Date: Fri, 13 Mar 2026 12:24:41 +0100
Subject: [PATCH] Fortran: Fix caf-tests on older glibcs [PR124484]

gcc/testsuite/ChangeLog:

	PR Fortran/124484
	* gfortran.dg/coarray/caf.exp: Add -pthread and -lrt for
	*-linux* targets for caf_shmem testing.
---
 gcc/testsuite/gfortran.dg/coarray/caf.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gfortran.dg/coarray/caf.exp b/gcc/testsuite/gfortran.dg/coarray/caf.exp
index 3db249a920f8..9f10f45187d7 100644
--- a/gcc/testsuite/gfortran.dg/coarray/caf.exp
+++ b/gcc/testsuite/gfortran.dg/coarray/caf.exp
@@ -123,7 +123,11 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]]
             if { [istarget *-*-freebsd*] } {
                 dg-test $test "-fcoarray=lib -pthread $flags -lcaf_shmem" {}
             } else {
-                dg-test $test "-fcoarray=lib $flags -lcaf_shmem" {}
+                if { [istarget *-linux*] } {
+                    dg-test $test "-fcoarray=lib -pthread $flags -lcaf_shmem" {}
+                } else {
+                    dg-test $test "-fcoarray=lib $flags -lcaf_shmem" {}
+                }
             }
             cleanup-modules ""
         }
-- 
2.53.0

Reply via email to