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).
And now:
In file included from .../libgfortran/intrinsics/erfc_scaled.c:33:
.../libgfortran/intrinsics/erfc_scaled_inc.c:
In function 'erfc_scaled_r4':
.../libgfortran/intrinsics/erfc_scaled_inc.c:169:15: warning: target format
does not support infinity
169 | res = __builtin_inf ();
| ^~~~~~~~~~~~~
In file included from .../libgfortran/intrinsics/erfc_scaled.c:39:
.../libgfortran/intrinsics/erfc_scaled_inc.c:
In function 'erfc_scaled_r8':
.../libgfortran/intrinsics/erfc_scaled_inc.c:82:15: warning: floating constant
exceeds range of 'double'
82 | xbig = 26.543, xhuge = 6.71e+7, xmax = 2.53e+307;
| ^~~~
.../libgfortran/intrinsics/erfc_scaled_inc.c:169:15: warning: target format
does not support infinity
169 | res = __builtin_inf ();
| ^~~~~~~~~~~~~
and:
.../libgfortran/intrinsics/c99_functions.c: In function 'tgamma':
.../libgfortran/intrinsics/c99_functions.c:1866:3: warning: floating constant
truncated to zero [-Woverflow]
1866 | static const double xminin = 2.23e-308;
| ^~~~~~
.../libgfortran/intrinsics/c99_functions.c:1868:60: warning: target format does
not support infinity
1868 | static const double xnan = __builtin_nan ("0x0"), xinf =
__builtin_inf ();
|
^~~~~~~~~~~~~{standard input}: Assembler messages:
{standard input}:487: Fatal error: Junk at end of expression "QNaN"
make[3]: *** [Makefile:6466: c99_functions.lo] Error 1
I am going to give up at this point, as porting libgfortran to non-IEEE FP
is surely well beyond what I can afford to do right now.
Maciej