Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6681796
Votes 0
Synopsis hotspot build failure on gcc 4.2.x (ubuntu 8.04) w/ openjdk6
Category hotspot:other
Reported Against b09 , b23
Release Fixed hs14(b01), 6-open(b11) (Bug ID:2163632) , hs11(b14) (Bug ID:2164300) , 6u10(b27) (Bug ID:2172094)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6625327 , 6752407
Submit Date 29-MAR-2008
Description
I tried compiling openjdk6 b08 on ubuntu 8.04.  The default compiler is gcc 4.2.x.  The following
does not occur on ubuntu 7.10 where the default gcc is 4.1.x.

Some hotspot files fail to compile due to warnings.  The default hotspot makefiles use
the -Werror flag, making warnings into errors and the build fails.  The warnings are
about type conversion of strings to constants.

The obvious workaround is to edit the hotspot makefile to not use -Werror.  This works.

I also made the following source changes and had a successful compile.  The idea is to
in some cases change some declarations to use "const char *" instead of "char *"
and in other cases cast string constants to "char *" depending on the context.

--- ./hotspot/src/share/vm/opto/escape-orig.cpp 2008-03-24 14:42:12.000000000 -0700
+++ ./hotspot/src/share/vm/opto/escape.cpp      2008-03-24 14:45:09.000000000 -0700
@@ -54,21 +54,21 @@
 }
 
 #ifndef PRODUCT
-static char *node_type_names[] = {
+static const char *node_type_names[] = {
   "UnknownType",
   "JavaObject",
   "LocalVar",
   "Field"
 };
 
-static char *esc_names[] = {
+static const char *esc_names[] = {
   "UnknownEscape",
   "NoEscape     ",
   "ArgEscape    ",
   "GlobalEscape "
 };
 
-static char *edge_type_suffix[] = {
+static const char *edge_type_suffix[] = {
  "?", // UnknownEdge
  "P", // PointsToEdge
  "D", // DeferredEdge
--- ./hotspot/src/share/vm/ci/ciMethodBlocks-orig.cpp   2008-03-24 14:39:19.000000000 -0700
+++ ./hotspot/src/share/vm/ci/ciMethodBlocks.cpp        2008-03-24 14:40:06.000000000 -0700
@@ -321,7 +321,7 @@
 }
 
 #ifndef PRODUCT
-static char *flagnames[] = {
+static const char *flagnames[] = {
   "Processed",
   "Handler",
   "MayThrow",
--- ./hotspot/src/os/linux/vm/jvm_linux-orig.cpp        2008-03-24 14:01:55.000000000 -0700
+++ ./hotspot/src/os/linux/vm/jvm_linux.cpp     2008-03-24 14: customer :07.000000000 -0700
@@ -135,7 +135,7 @@
 */
 
 struct siglabel {
-  char *name;
+  const char *name;
   int   number;
 };
 
--- ./hotspot/src/os/linux/vm/vmError_linux-orig.cpp    2008-03-24 14:25:17.000000000 -0700
+++ ./hotspot/src/os/linux/vm/vmError_linux.cpp 2008-03-24 14:26:01.000000000 -0700
@@ -50,8 +50,8 @@
 // doesn't block SIGINT et al.
 int VMError::fork_and_exec(char* cmd) {
   char * argv[4];
-  argv[0] = "sh";
-  argv[1] = "-c";
+  argv[0] = (char *)"sh";
+  argv[1] = (char *)"-c";
   argv[2] = cmd;
   argv[3] = NULL;
Posted Date : 2008-03-29 00:00:27.0
Work Around
N/A
Evaluation
The fix is to try to use "const char*" to define constant string and apply the cast from "const char*" to "char*" carefully.
Posted Date : 2008-06-06 22:15:50.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang