[patch] hotspot miscompilation of OpenJDK6 with gcc from the gcc-4_3-branch

Matthias Klose doko at ubuntu.com
Fri Jul 25 06:51:04 PDT 2008

OpenJDK (using the IcedTea6 build and patches) fails to build with 4.3 from the
4.3 branch, when the jvm built in stage1 is used for the first time in the
stage2 build:

    [javac] Compiling 2 source files to
WARNING: Default charset US-ASCII not supported, using ISO-8859-1 instead
cannot access unnamed package
    [javac] ANSI_X3.4-1968
    [javac] import java.io.BufferedWriter;
    [javac] ^


the build failure is not seen when reverting r136501; seen as well when just
reverting the two hunks for record_numbers_of_iterations.

seen with -O3 and -O2, not -O1.

not seen on amd64 and sparc (the other two archs using OpenJDK hotspot).

the miscompiled file is ciTypeFlow.cpp, compiled using
g++-4.3 -fpic -fno-rtti -fno-exceptions -D_REENTRANT -fcheck-new -g -m32
-march=i586 -mtune=generic -O2 -fno-strict-aliasing -DVM_LITTLE_ENDIAN
-Wpointer-arith -Wconversion -Wsign-compare -c ciTypeFlow.cpp

Upstream GCC [1] doesn't agree on a bug in the compiler, but in the application

  "I belive this is just INVALID.  The code seems to do lots of things with
  this enum Cell, but the C++ compiler is allowed to just allocate 1 bit of
  storage for it.

  Maybe changing the Cell declaration to

    enum Cell { Cell_0, Cell_max = UINT_MAX }

  fixes the issue.

  See 7.2/6 for the standard wording."

The suggested fix is attached; I don't see any regressions. IcedTea currently
has a patch to work around the problem, compiling this file with -fno-ivopts.


[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36917
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: citypeflow.diff
Url: http://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20080725/3ff5a494/attachment.ksh 

More information about the hotspot-dev mailing list