On Mon, 2024-12-30 21:13:50 +0100, Jan-Benedict Glaw <jbglaw%lug-owl.de@localhost> wrote: > On Sat, 2024-12-28 16:01:50 +0000, John Klos <john%klos.com@localhost> wrote: > > Perl is now at version 5.40.0. This new version fails to compile because it > > wants to use NV_INF and NV_NAN. > > > > What's the best way to fix this? > > > Seems this came with > > commit 5fdf6e90221900a85cd3091bd2755e41fc230d4d > Author: Paul Evans <leonerd%leonerd.org.uk@localhost> > Date: Mon Jan 22 22:29:39 2024 +0000 > > Add builtin::inf and builtin::nan > > > https://github.com/Perl/perl5/commit/5fdf6e90221900a85cd3091bd2755e41fc230d4d > > As there is configury available for some aspects of FP NANs / INFs, I > think that this was just an oversight and not a design decision to > drop anything except IEEE math. Cf. d_double_style_vax, > d_double_has_inf and d_double_has_nan. > > For now, I just started a build with reverting that patch. Let's see > where this takes us to... With the following patch, Perl 5.40 successfully built (though I didn't play with the Perl interpreter as I'm by no means a Perl guy): # cat ${LOCALPATCHES}/lang/perl5/patch-infnan --- builtin.c~jb 2024-12-31 11:11:52.361258111 +0000 +++ builtin.c 2024-12-31 11:14:00.911496537 +0000 @@ -90,31 +90,9 @@ XSRETURN_NO; } -XS(XS_builtin_inf); -XS(XS_builtin_inf) -{ - dXSARGS; - if(items) - croak_xs_usage(cv, ""); - EXTEND(SP, 1); - XSRETURN_NV(NV_INF); -} - -XS(XS_builtin_nan); -XS(XS_builtin_nan) -{ - dXSARGS; - if(items) - croak_xs_usage(cv, ""); - EXTEND(SP, 1); - XSRETURN_NV(NV_NAN); -} - enum { BUILTIN_CONST_FALSE, BUILTIN_CONST_TRUE, - BUILTIN_CONST_INF, - BUILTIN_CONST_NAN, }; static OP *ck_builtin_const(pTHX_ OP *entersubop, GV *namegv, SV *ckobj) @@ -135,8 +113,6 @@ switch(builtin->ckval) { case BUILTIN_CONST_FALSE: constval = &PL_sv_no; break; case BUILTIN_CONST_TRUE: constval = &PL_sv_yes; break; - case BUILTIN_CONST_INF: constval = newSVnv(NV_INF); break; - case BUILTIN_CONST_NAN: constval = newSVnv(NV_NAN); break; default: DIE(aTHX_ "panic: unrecognised builtin_const value %" IVdf, builtin->ckval); @@ -546,8 +522,6 @@ /* constants */ { "true", SHORTVER(5,39), &XS_builtin_true, &ck_builtin_const, BUILTIN_CONST_TRUE, false }, { "false", SHORTVER(5,39), &XS_builtin_false, &ck_builtin_const, BUILTIN_CONST_FALSE, false }, - { "inf", NO_BUNDLE, &XS_builtin_inf, &ck_builtin_const, BUILTIN_CONST_INF, true }, - { "nan", NO_BUNDLE, &XS_builtin_nan, &ck_builtin_const, BUILTIN_CONST_NAN, true }, /* unary functions */ { "is_bool", NO_BUNDLE, &XS_builtin_func1_scalar, &ck_builtin_func1, OP_IS_BOOL, true }, --- lib/builtin.pm~jb 2024-12-31 11:14:13.181519277 +0000 +++ lib/builtin.pm 2024-12-31 11:15:10.461625395 +0000 @@ -18,7 +18,6 @@ use builtin qw( true false is_bool - inf nan weaken unweaken is_weak blessed refaddr reftype created_as_string created_as_number @@ -146,22 +145,6 @@ This function used to be named C<isbool>. A compatibility alias is provided currently but will be removed in a later version. -=head2 inf - - $num = inf; - -This function is currently B<experimental>. - -Returns the floating-point infinity value. - -=head2 nan - - $num = nan; - -This function is currently B<experimental>. - -Returns the floating-point "Not-a-Number" value. - =head2 weaken weaken($ref); --- lib/builtin.t~jb 2024-12-31 11:15:23.441649432 +0000 +++ lib/builtin.t 2024-12-31 11:15:59.891716916 +0000 @@ -51,25 +51,6 @@ is(prototype(\&builtin::is_bool), '$', 'is_bool prototype'); } -# float constants -{ - use builtin qw( inf nan ); - - ok(inf, 'inf is true'); - ok(inf > 1E10, 'inf is bigger than 1E10'); - ok(inf == inf, 'inf is equal to inf'); - ok(inf == inf + 1, 'inf is equal to inf + 1'); - - # Invoke the real XSUB - my $inf = ( \&builtin::inf )->(); - ok($inf == $inf + 1, 'inf returned by real xsub'); - - ok(nan != nan, 'NaN is not equal to NaN'); - - my $nan = ( \&builtin::nan )->(); - ok($nan != $nan, 'NaN returned by real xsub'); -} - # weakrefs { use builtin qw( is_weak weaken unweaken ); With that, we can start guarding these pieces with d_double_style_vax, d_double_has_inf and d_double_has_nan. But maybe somebody else should work on that? Did anybody already open a bug report upstream? I'd like to not open multiple tickets, that won't help at all I guess... MfG, JBG --
Attachment:
signature.asc
Description: PGP signature