[patch, libfortran] Fix PR 123446, broken bootstrap

Thomas Koenig tkoenig@netcologne.de
Thu Jan 8 07:06:55 GMT 2026


  Hello world,

I just realized that it is possible to run a check by #undef - ing
  __GTHREADS_CXX0X in async.h.  Doing so promptly found another
syntax error, which this version of the patch fixes.

As this should definitely restore bootstrap, I plan to commit
this tonight unless there are objections.  Further fallout can be
handled later.

ChangeLog identical to the one below.

Best regards

	Thomas


> the attached patch hopefully fixes the bootstrap problem on
> systems without threading support. I have tested it as far
> as I could, but I could not find any way to test it. It looks
> OK to me, but...
> 
> I also tested it on a system where there is no pthreads in
> libc, that should hopefully also be fixed.
> 
> Anybody up for testing on one of the systems that I do not have
> access to?  OK for trunk?
> 
> Best regards
> 
>      Thomas
> 
> PR libfortran/123446
> PR libfortran/119136
> 
> libgfortran/ChangeLog:
> 
>      * io/async.h: DEBUG_ASYNC needs gtreads support.
>      (LOCK_UNIT): Only lock when there is pthreads support and it is 
> active.
>      Otherwise, just set unit->self to 1.
>      (UNLOCK_UNIT): Only unlock when there is pthreads support and it is 
> active.
>      Otherwise, just set unit->self to 0.
>      (TRYLOCK_UNIT): Only try locking when thee is pthreads support and 
> it is
>      active.  Otherwise, return unit->self.
>      (OWN_THREAD_ID): New macro.
>      * io/io.h: gfc_unit's self is an int when there is no gthreads 
> support.
>      * io/unit.c (check_for_recursive): Check for equality of unit which
>      locked to OWN_THREAD_ID.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p3a.diff
Type: text/x-patch
Size: 12510 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20260108/e4399160/attachment-0001.bin>


More information about the Gcc-patches mailing list