RFR: 8295159: DSO created with -ffast-math breaks Java floating-point arithmetic
Vladimir Ivanov
vlivanov at openjdk.org
Wed Oct 26 17:55:24 UTC 2022
On Wed, 26 Oct 2022 17:10:00 GMT, David Holmes <david.holmes at oracle.com> wrote:
> At most an expanded -Xcheck:jni check for FP-state manipulation, with an
enhanced/fixed RestoreMXCSROnJNICalls is in order IMVHO.
FTR both `-Xcheck:jni` and `-XX:+RestoreMXCSROnJNICalls` already catch the problematic case being discussed.
$ .../jdk/bin/java ... compiler/floatingpoint/TestDenormalDouble
Exception in thread "main" java.lang.AssertionError: TEST FAILED: 0.0
at compiler.floatingpoint.TestDenormalDouble.testDoubles(TestDenormalDouble.java:42)
at compiler.floatingpoint.TestDenormalDouble.main(TestDenormalDouble.java:52)
$ .../jdk/bin/java ... -Xcheck:jni compiler/floatingpoint/TestDenormalDouble
Loading libfast-math.so
Java HotSpot(TM) 64-Bit Server VM warning: MXCSR changed by native JNI code, use -XX:+RestoreMXCSROnJNICall
Test passed.
$ .../jdk/bin/java ... -XX:+RestoreMXCSROnJNICalls compiler/floatingpoint/TestDenormalDouble
Loading libfast-math.so
Test passed.
-------------
PR: https://git.openjdk.org/jdk/pull/10661
More information about the build-dev
mailing list