On Mon, Jan 05, 2026 at 08:56:34PM +0100, Thomas Koenig wrote:
> Hi Jerry,
>
> >
> > Regarding the test case, for it to pass on FreeBSD one needs the following:
> >
> > ! { dg-do run }
> > ! { dg-options "-pthread" { target { x86_64-*-freebsd* } } }
> > ! { dg-shouldfail "Recursive" }
>
> That should not be the case. I think I know what was wrong, and
> tried to fix it in the attached patch, which also includes the
> test case.
>
> Would it be possible for somebody with FreeBSD access to check
> that the test case now also passes there?
With your p2.diff applied to gcc/, bootstrapped, and
installed.
% cp ~/gcc/gccx/gcc/testsuite/gfortran.dg/pr119136.f90 .
% gfcx -o z pr119136.f90 && ./z
foo
42 42
% gfcx -o z -pthread pr119136.f90 && ./z
At line 7 of file pr119136.f90 (unit = 6, file = 'stdout')
Fortran runtime error: Recursive I/O not allowed
On FreeBSD, -lpthread is not added to the command line
unless the -pthread option is specified.
% gfcx -o z pr119136.f90 && ./z
% ldd ./z
./z:
libgfortran.so.5 => /usr/home/sgk/work/x/lib/libgfortran.so.5
libm.so.5 => /lib/libm.so.5 (0x1db8b5c2d000)
libgcc_s.so.1 => /usr/home/sgk/work/x/lib/libgcc_s.so.1
libquadmath.so.0 => /usr/home/sgk/work/x/lib/libquadmath.so.0
libc.so.7 => /lib/libc.so.7
libsys.so.7 => /lib/libsys.so.7
% gfcx -o z -pthread pr119136.f90
% ldd ./z
./z:
libgfortran.so.5 => /usr/home/sgk/work/x/lib/libgfortran.so.5
libm.so.5 => /lib/libm.so.5
libgcc_s.so.1 => /usr/home/sgk/work/x/lib/libgcc_s.so.1
libquadmath.so.0 => /usr/home/sgk/work/x/lib/libquadmath.so.0
libthr.so.3 => /lib/libthr.so.3
libc.so.7 => /lib/libc.so.7
libsys.so.7 => /lib/libsys.so.7 (0x1bc4212f8000)
libthr.so is the pthread library.
--
steve