JDK-4294714 : fdlibm uses HI/LO macros which depend on pointer aliasing - portability issue
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.3.0
  • Priority: P5
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 1999-11-25
  • Updated: 2024-04-12
  • Resolved: 2023-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
fdlibm 5.2 uses HI and LO macros which depend on pointer aliasing :-


#ifdef __LITTLE_ENDIAN
#define __HI(x) *(1+(int*)&x)
#define __LO(x) *(int*)&x
#define __HIp(x) *(1+(int*)x)
#define __LOp(x) *(int*)x
#else
#define __HI(x) *(int*)&x
#define __LO(x) *(1+(int*)&x)
#define __HIp(x) *(int*)x
#define __LOp(x) *(1+(int*)x)
#endif

Compilers such as GCC 2.95 are senstive compared to old versions
of GCC and thus can't handle these macros as intended. 

From a portability perspective it would be good to replace these
macros in a future Java 2 release.
###@###.### 2004-11-11 22:24:08 GMT

Comments
FDLIBM was fully ported to Java (JDK-8171407) and the original C sources removed (JDK-8302801).
07-03-2023

FDLIBM is only partially ported; I'll close out the cluster of these related issues when it is fully ported.
12-06-2020

fdlibm is gone.
12-06-2020

fdlibm is gone, can this issue be closed?
08-12-2017

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: dragon
14-06-2004

WORK AROUND Possible workaround on GCC 2.95 is to compile with -fno-strict-aliasing in combination with -O1 or -O2.
11-06-2004

SUGGESTED FIX Replacing aliasing with a union containing a double and int.
11-06-2004

EVALUATION FDLIBM should be ported to Java for use as Java's math library. That will eliminate the pointer bashing aliasing problems entirely, providing a version of the math library whose semantics don't depend on external compiler flags. joe.darcy@eng 2001-03-27 Deferring porting effort until after Tiger. ###@###.### 2003-09-08
27-03-2001