Re: [patch, libfortran] Fix PR 123446, broken bootstrap

Hans-Peter Nilsson <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
Edit: I just saw your updated patch.  Thanks, will try it.
The following still has merit, though:

> Date: Wed, 7 Jan 2026 23:16:20 +0100
> From: Thomas Koenig <[email protected]>

> Hello world,
> 
> 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?

You always have access to a GNU simulator toolchain.  The
page "https://gcc.gnu.org/simtest-howto.html" is...a bit
dated... (yours truly takes the most blame), but you can
easily derive the information you need from it.  (Most
importantly, I'd suggest to build and install binutils+sim
*separately*, not in a "combined tree".  Also,
cris-elf+cris-sim isn't mentioned there, probably because
the dejagnu support wasn't in the recommended version - I
think it is now.)

Having said that...

>  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.

...I tested your patch, but unfortunately the status at
r16-6568-gbba999a7f330 is still broken for cris-elf with
that patch.  Maybe the cause is a subsequent patch as I
don't see aio_do mentioned in your patch.  Anyway, the
breakage at r16-6568-gbba999a7f330:

----->
libtool: compile:  /obj/./gcc/xgcc -B/obj/./gcc/ -nostdinc -B/obj/cris-elf/newlib/ -isystem /obj/cris-elf/newlib/targ-include -isystem /src/newlib/libc/include -B/obj/cris-elf/libgloss/cris -L/obj/cris-elf/libgloss/libnosys -L/src/libgloss/cris -B/prefix/cris-elf/bin/ -B/prefix/cris-elf/lib/ -isystem /prefix/cris-elf/include -isystem /prefix/cris-elf/sys-include -DHAVE_CONFIG_H -I. -I/src/libgfortran -iquote/src/libgfortran/io -I/src/libgfortran/../gcc -I/src/libgfortran/../gcc/config -I../../.././gcc -I/src/libgfortran/../libgcc -I../../libgcc -I/src/libgfortran/../libbacktrace -I../../libbacktrace -I../libbacktrace -std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla -fcx-fortran-rules -
 ffunction-sections -fdata-sections -g -O2 -march=v8 -mbest-lib-options -MT generated/any_l1.lo -MD -MP -MF generated/.deps/any_l1.Tpo -c /src/libgfortran/generated/any_l1.c -o generated/any_l1.o
In file included from /src/libgfortran/runtime/error.c:28:
/src/libgfortran/io/async.h:443:5: error: expected identifier or '(' before '}' token
  443 |     })
      |     ^
/src/libgfortran/io/async.h:443:6: error: expected identifier or '(' before ')' token
  443 |     })
      |      ^
/src/libgfortran/io/async.h:644:67: warning: 'enum aio_do' declared inside parameter list will not be visible outside of this definition or declaration
  644 | void enqueue_transfer (async_unit * au, transfer_args * arg, enum aio_do);
      |                                                                   ^~~~~~
/src/libgfortran/io/async.h:647:39: warning: 'enum aio_do' declared inside parameter list will not be visible outside of this definition or declaration
  647 | void enqueue_done (async_unit *, enum aio_do type);
      |                                       ^~~~~~
/src/libgfortran/io/async.h:650:41: warning: 'enum aio_do' declared inside parameter list will not be visible outside of this definition or declaration
  650 | int enqueue_done_id (async_unit *, enum aio_do type);
      |                                         ^~~~~~
make[6]: *** [Makefile:4537: runtime/error.lo] Error 1
-----<

I'll test at r16-6515-ge32c3fb4311bca too.

brgds, H-P
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.