On Tue, 24 Nov 2020, Maciej W. Rozycki wrote: > > I don't know how or why __FLT_HAS_INFINITY is set for a target which > > does not support it, but if you get rid of that macro, that particular > > problem should be solved. > > Thanks for the hint; I didn't look into it any further not to distract > myself from the scope of the project. I have now, and the check you have > quoted is obviously broken (as are all the remaining similar ones), given: > > $ vax-netbsdelf-gcc -E -dM - < /dev/null | sort | grep _HAS_ > #define __DBL_HAS_DENORM__ 0 > #define __DBL_HAS_INFINITY__ 0 > #define __DBL_HAS_QUIET_NAN__ 0 > #define __FLT_HAS_DENORM__ 0 > #define __FLT_HAS_INFINITY__ 0 > #define __FLT_HAS_QUIET_NAN__ 0 > #define __LDBL_HAS_DENORM__ 0 > #define __LDBL_HAS_INFINITY__ 0 > #define __LDBL_HAS_QUIET_NAN__ 0 > $ > > which looks reasonable to me. This seems straightforward to fix to me, so > I'll include it along with verification I am about to schedule (assuming > that this will be enough for libgfortran to actually build; obviously it > hasn't been tried by anyone with such a setup for a while now, as these > libgfortran checks date back to 2009).
Well, it is still broken, owing to NetBSD failing to implement POSIX 2008 locale handling correctly, apparently deliberately[1], and missing uselocale(3)[2] while still providing newlocale(3). This confuses our conditionals and consequently: .../libgfortran/io/transfer.c: In function 'data_transfer_init_worker': .../libgfortran/io/transfer.c:3416:30: error: 'old_locale_lock' undeclared (first use in this function) 3416 | __gthread_mutex_lock (&old_locale_lock); | ^~~~~~~~~~~~~~~ etc. We can probably work it around by downgrading to setlocale(3) for NetBSD (i.e. whenever either function is missing) unless someone from the NetBSD community contributes a better implementation (they seem to prefer their own non-standard printf_l(3) library API). References: [1] Martin Husemann, "Re: uselocale() function", <https://mail-index.netbsd.org/netbsd-users/2017/02/14/msg019351.html> [2] "The Open Group Base Specifications Issue 7, 2018 edition", IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008), <https://pubs.opengroup.org/onlinepubs/9699919799/functions/uselocale.html> Maciej