Bug 234689 - java/openjdk8: Math.asin() (and StrictMath.asin()) seem to be broken
Summary: java/openjdk8: Math.asin() (and StrictMath.asin()) seem to be broken
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Greg Lewis
URL:
Keywords: needs-qa
Depends on:
Blocks: 234579
  Show dependency treegraph
 
Reported: 2019-01-07 10:41 UTC by thgude
Modified: 2019-02-10 13:00 UTC (History)
9 users (show)

See Also:
tcberner: maintainer-feedback-


Attachments
Java test program (3.27 KB, text/plain)
2019-01-07 10:41 UTC, thgude
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description thgude 2019-01-07 10:41:04 UTC
Created attachment 200862 [details]
Java test program

In openjdk8 (v8.192.26) the Math.asin() method returns wrong values. This can be reproduced by the attached test program (CheckMathIssue.java). Previous versions (e.g. 8.172) did return correct results. The comments in the test program show results of the test program for four different platforms:
- FreeBSD 11.2 openjdk8-8.192
- FreeBSD 11.2 openjdk8-8.172
- MacOs 10.14 Oracle JDK 8.192
- Linux OSMC (ARM) 4.14 openjdk8-8.191

The latter three return identical (and correct) results. So, there seems to be a bug in  the current version of openjdk8.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-01-07 10:57:22 UTC
This may be related to bug 234579, if not the underlying cause of it.

If it is the same issue, please:

1) Set this issue as "Blocks" bug 234579, or
2) Close this issue as a duplicate of 234579, and update the summary of the latter to:

java/openjdk8: Math.asin() and StrictMath.asin() broken (affects at least math/geogebra)
Comment 2 Tobias C. Berner freebsd_committer freebsd_triage 2019-01-09 07:20:11 UTC
Given that it works going back to the previous version, and me noticing the issue on december 12, the bug must have been introduced in one of the following :


------------------------------------------------------------------------
r487219 | glewis | 2018-12-11 04:23:57 +0100 (Di., 11 Dez. 2018) | 5 lines

. Fix build on gcc based architectures (e.g. powerpc64)

PR:             233883
Submitted by:   Piotr Kubaj <pkubaj@anongoth.pl>

------------------------------------------------------------------------
r486983 | glewis | 2018-12-08 20:09:28 +0100 (Sa., 08 Dez. 2018) | 5 lines

. Fix SCTP support.

PR:             230321
Submitted by:   Timo Voelker <timo.voelker@fh-muenster.de>

------------------------------------------------------------------------
r486976 | glewis | 2018-12-08 19:43:56 +0100 (Sa., 08 Dez. 2018) | 5 lines

. Fix compilation on powerpc64

PR:             223834
Submitted by:   Curtis Hamilton <hamiltcl@verizon.net>

------------------------------------------------------------------------
r486973 | glewis | 2018-12-08 19:35:30 +0100 (Sa., 08 Dez. 2018) | 4 lines

. Update to 8u192.

PR:             230364

------------------------------------------------------------------------
r485094 | jkim | 2018-11-16 18:30:17 +0100 (Fr., 16 Nov. 2018) | 7 lines

- Fix reversed ccache version detection logic.  Enable ccache support.
- Use '-pthread' for Clang.  Clang supports '-pthread' on all BSDs except
for Darwin. [1]

Reported by:    Achilleas Mantzios <achill@matrix.gatewaynet.com> [1]
Tested by:      Achilleas Mantzios <achill@matrix.gatewaynet.com> [1]

------------------------------------------------------------------------
Comment 3 Mark.Martinec 2019-01-16 15:14:29 UTC
This also breaks astro/josm and astro/osmosis.

(angles show up as multiples of 90 degrees, or results manifest as NaN)
Comment 4 Tobias C. Berner freebsd_committer freebsd_triage 2019-01-25 16:07:26 UTC
java@, any opinions or progress? 

Mfg Tobias
Comment 5 Robert Roth 2019-01-30 08:57:55 UTC
I have seen the same thing, but with Math.atan2 (which is the same as StrictMath.atan2), so that function is also broken.

I have seen it working correctly on 1.8.0.162 and 1.8.0.172 and incorrectly on 1.8.0.192b26. I have made a full diff of 1.8.0.162 and 1.8.0.192 in the java.lang native code (implementing StrictMath.c), and there are no differences there, so it might be build-related (maybe clang vs gcc)
Comment 6 Mark.Martinec 2019-01-30 13:32:52 UTC
I have reverted my openjdk8 package to openjdk8-8.181.13_1 (and locked it
to prevent automatic pkg upgrade). It was built locally with a poudriere.
That version is the last version I have that is working correctly (with
astro/josm and astro/osmosis).
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-02-09 07:16:53 UTC
A commit references this bug:

Author: glewis
Date: Sat Feb  9 07:16:05 UTC 2019
New revision: 492485
URL: https://svnweb.freebsd.org/changeset/ports/492485

Log:
  . When upgrading to 8u192 the endianess definitions specific to BSD were
    missed during a large merge of the configuration file.  This resulted in,
    at least, macros affecting maths operations using the big endian rather
    than the little endian versions.

  PR:		234689

Changes:
  head/java/openjdk8/Makefile
  head/java/openjdk8/files/patch-endian
Comment 8 Greg Lewis freebsd_committer freebsd_triage 2019-02-09 07:20:14 UTC
Fix committed.  I tested it with the test program attached to this.

If someone can test astro/josm too that would be great.
Comment 9 thgude 2019-02-09 11:03:31 UTC
Thanks Greg! I recompiled and tested in my environment and it works again (including my openhab2-2.4 installation which depends on this package).
Comment 10 Ronald Klop 2019-02-10 13:00:42 UTC
(In reply to commit-hook from comment #7)
(In reply to Greg Lewis from comment #8)
Thanks for the fix. Any plans to merge this to the quarterly branch of ports?