Sorry, previous patch had -lrt missing. I should have checked before sending.
Therefore now here the correct patch.

- Andre

On Fri, 13 Mar 2026 16:22:41 +0100
Andre Vehreschild <[email protected]> wrote:

> 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 ed6f79a7c238608ad9900826d8ee33d4bd13b586 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..bb4fb53050e1 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 -lrt" {}
+                } else {
+                    dg-test $test "-fcoarray=lib $flags -lcaf_shmem" {}
+                }
             }
             cleanup-modules ""
         }
-- 
2.53.0

Reply via email to