Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix three issues building with the sun/oracle workshop compiler #21610

Merged
merged 7 commits into from
Nov 8, 2023

Conversation

tonycoz
Copy link
Contributor

@tonycoz tonycoz commented Nov 2, 2023

Fixes #21535
Fixes #21533
Fixes a build issue with c99 from sun/oracle workshop.

@tonycoz
Copy link
Contributor Author

tonycoz commented Nov 5, 2023

Need to look into the MSVC failures, I suspect it's a config.sh issue

Encountered while testing -O1 with the workshop compiler on
Oracle Linux, follows the same test and workaround done in
hints/solaris_2.sh
The test in Configure warns:

/* Note that whether the sign bit is on or off
 * for NaN depends on the CPU/FPU, and possibly
 * can be affected by the build toolchain.

but this test assumed that the default NaN was always positive,
but this isn't the case with the Sun/Oracle workshop cc, whether
on Oracle Linux or on Solaris.

copysign() is however well defined for NaN, so we can modify the
sign on NaN and test that with signbit().

Fixes Perl#21533
This is enabled in config.gc, and gcc builds were using only msvcrt
for a long time, so presumably MSVC 2013 which uses msvcrt also
supports it.  Later MSVC uses ucrt which definitely supports
copysign.
But it appears that the fallback for Perl_signbit() in numeric.c
is broken when we've found a definition for Perl_fp_class_nzero().

When Perl_fp_class_nzero is defined, the fallback Perl_signbit()
simply returns that value, but Perl_fp_class_nzero() only returns
true when the number is negative zero, not for any negative number.

But C99 requires signbit(), so I don't think it's worth spending
any more time looking into this.  We might want to eliminate
Perl_signbit() from numeric.c, or try to fix it.
It also defines fpclassify(), but that's a more complex change
due to the classification macros in perl.h
@tonycoz tonycoz merged commit af40277 into Perl:blead Nov 8, 2023
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Many core dumps in v5.38.0 during tests on 64-bit Solaris POSIX shouldn't test signbit(NAN)
2 participants