https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124512
--- Comment #16 from Christopher Albert <albert at tugraz dot at> --- Created attachment 63985 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63985&action=edit Updated patch: disable caf_shmem without usable process-shared pthread support Tested this again on cfarm428 after splitting the unrelated host issue to PR124586. The host-side fix from PR124586 alone gets native aarch64-netbsd past the stage1 driver link, but the build still fails in libgfortran/caf/shmem/thread_support.c: error: implicit declaration of function 'pthread_mutexattr_setpshared' error: implicit declaration of function 'pthread_condattr_setpshared' So the host_detect_local_cpu fix does not solve this bug; it only exposes the next failure. Per comment #14, the better formulation is not "NetBSD has no ..." but that the required process-shared pthread API is not usable through the default headers. Forcing _PTHREAD_PSHARED makes caf_shmem compile, but as Andre observed that still does not produce a working backend. Based on that, I reworked the patch to keep this PR scoped to libgfortran only and to disable caf_shmem cleanly when the required interface is not usable through normal headers and normal pthread flags. The updated patch: - drops the unrelated gcc/config.host hunk (now PR124586) - after AX_PTHREAD, uses a compile-only probe for pthread_mutexattr_setpshared, pthread_condattr_setpshared, and PTHREAD_PROCESS_SHARED - disables ENABLE_CAF_SHMEM when that probe fails - removes libcaf_shmem.la from cafexeclib_LTLIBRARIES when disabled, so the build no longer leaves a dead shmem target behind - uses AC_COMPILE_IFELSE rather than AC_LINK_IFELSE, so it remains valid after GCC_NO_EXECUTABLES in cross configurations Results: - local Linux x86_64 full check-gfortran: 75272 expected passes, 345 expected failures, 84 unsupported, 0 FAIL / XPASS / UNRESOLVED - cfarm428 NetBSD/aarch64 focused gfortran.dg/coarray/caf.exp, with PR124586 and PR95128 layered for testing: 480 expected passes, 4 unsupported, 0 FAIL / XPASS / UNRESOLVED - cfarm428 full check-gfortran with PR124586 + this patch completes, and the remaining failures are in unrelated NetBSD/aarch64 runtime areas (for example ubound-poly, bind-c-intent-out, dec_math, internal_dummy_*, optional_absent_*), not in caf_shmem/coarray coverage So this should address the points from comments #14 and #15: - the host-side issue is separate and is handled in PR124586 - this PR now contains the autoconf/configure-side fix only - the solution is capability-based rather than target-blacklisting and disables caf_shmem only when the required process-shared pthread interface is not actually usable
