On Thu, Feb 12, 2026 at 08:17:21PM -0800, Steve Kargl wrote:
> On Wed, Feb 11, 2026 at 10:58:32AM +0100, Tobias Burnus wrote:
> > Jerry D wrote:
> > > + foreach flags $option_list {
> > > + verbose "Testing $nshort (libcaf_shmem), $flags" 1
> > > + set gfortran_aux_module_flags "-fcoarray=lib $flags -lcaf_shmem"
> > > + dg-test $test "-fcoarray=lib $flags -lcaf_shmem" {}
> > > + cleanup-modules ""
> > > + }
> >
> > As mentioned in 13/13, the current implementation seems to assume that POSIX
> > threads are available; additionally, -lpthread or -pthread might be needed
> > for linking. In any case, it seems as if some check is required whether
> > caf_shmem is actually available; otherwise, the shmem tests have to be
> > skipped.
> >
>
> Unfortunately, I don't know how to fix. In libgomp/configure.txt one sees
>
> % more libgomp/configure.txt
> # This is the target specific configuration file. This is invoked by the
> # autoconf generated configure script. Putting it in a separate shell file
> # lets us skip running autoconf when modifying target specific information.
>
> # This file switches on the shell variable ${target}, and sets the
> # following shell variables:
> # config_path An ordered list of directories to search for
> # sources and headers. This is relative to the
> # config subdirectory of the source tree.
> # XCFLAGS Add extra compile flags to use.
> # XLDFLAGS Add extra link flags to use.
> # tmake_file A list of machine-description-specific
> # makefile fragments.
> ...
> *-*-freebsd*)
> # Need to link with -lpthread so libgomp.so is self-contained.
> XLDFLAGS="${XLDFLAGS} -lpthread"
> ;;
>
> It looks like AIX also needs -lpthread added to its linker flags.
> In libgfortran/configure.host, there are target specific checks,
> but adding the above with would unconditional add -lpthread to
> the linker flags even if caf_shmem is not used.
If I manually add -lpthread to caf.exp, then I see
=== gfortran Summary ===
# of expected passes 74989
# of unexpected failures 37
# of expected failures 343
# of unsupported tests 95
/home/kargl/gcc/obj/gcc/gfortran version 16.0.1 20260204 (experimental) (GCC)
which means caf_shmem seems to work on FreeBSD.
--
Steve