> Date: Mon, 5 Jan 2026 20:56:34 +0100
> From: Thomas Koenig <[email protected]>
That patch, committed as r16-6515-ge32c3fb4311bca, broke
build for non-gthreads targets (or possibly
"just"__GTHREADS_CXX0X targets) such as your typical
bare-iron *-elf target, as detailed in PR123446.
Looking at the patch, there's an obvious flaw.
Unconditional access to "self" member (multiple, just one
example):
> diff --git a/libgfortran/io/async.h b/libgfortran/io/async.h
> index 76c087c554a..07f1557a98c 100644
> --- a/libgfortran/io/async.h
> +++ b/libgfortran/io/async.h
> @@ -175,6 +175,11 @@
> INTERN_UNLOCK (mutex); \
> }while (0)
>
> +#define UNLOCK_UNIT(unit) do { \
> + unit->self = 0; \
> + UNLOCK(&(unit)->lock); \
> + } while(0)
> +
Also, unconditional access to __gthread_ functions:
@@ -210,6 +239,12 @@
DEBUG_PRINTF ("%s" DEBUG_RED "ACQ:" DEBUG_NORM " %-30s %78p\n",
aio_prefix, #mutex, mutex); \
} while (0)
+
+#define LOCK_UNIT(unit) do { \
+ LOCK (&(unit)->lock); \
+ (unit)->self = __gthread_self (); \
+ } while (0)
+
Conditional declaration of said member:
> --- a/libgfortran/io/io.h
> +++ b/libgfortran/io/io.h
> @@ -728,6 +728,9 @@ typedef struct gfc_unit
> int last_char;
> bool has_size;
> GFC_IO_INT size_used;
> +#ifdef __GTHREADS_CXX0X
> + __gthread_t self;
> +#endif
brgds, H-P