Skip to content

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

Merged
tonycoz merged 7 commits into
Perl:bleadfrom
tonycoz:21535-workshop-cc-optimize
Nov 8, 2023
Merged

Fix three issues building with the sun/oracle workshop compiler#21610
tonycoz merged 7 commits into
Perl:bleadfrom
tonycoz:21535-workshop-cc-optimize

Conversation

@tonycoz

@tonycoz tonycoz commented Nov 2, 2023

Copy link
Copy Markdown
Contributor

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

@tonycoz

tonycoz commented Nov 5, 2023

Copy link
Copy Markdown
Contributor Author

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
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