JDK-6510126 : intptr_t != int on all x86 operating systems
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-01-05
  • Updated: 2012-10-08
  • Resolved: 2007-01-31
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.
JDK 6 JDK 7 Other
6u4Fixed 7Fixed hs10Fixed
Received via the public mailing lists from ###@###.###:

I've been involved with porting the jdk to BSD for
several years now. One of the first things I need
to do is fix some improper datatypes only seen in
the x86 portion of hotspot where it assumes that
an intptr_t is the same datatype as an int. On at
least one BSD, intptr_t is defined as a long on x86,
which reveals the places in the x86 code where it
is assumed intptr_t is an int.

To see the problems I need to fix use the following
diff on linux/x86:

diff -ur hotspot.orig/src/share/vm/utilities/globalDefinitions_gcc.hpp hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
--- hotspot.orig/src/share/vm/utilities/globalDefinitions_gcc.hpp       2006-11-30 12:22:09.000000000 -0800
+++ hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp    2006-12-01 07:51:09.000000000 -0800
@@ -76,6 +76,8 @@
 # endif

 #ifdef LINUX
+typedef long intptr_t;
+#define __intptr_t_defined
 #include <inttypes.h>
 #include <signal.h>
 #include <ucontext.h>

Attached is a diff that corrects the improper datatype
assumptions. I don't have access to solaris/x86 or
windows/x86 so there could be additional changes needed

Feeback, review and acceptance of this patch would be
much appreciated.

[patch omitted]

EVALUATION Applied patch