[BUG] building libjava with -Os

Bryce McKinlay mckinlay@redhat.com
Mon Sep 27 19:00:00 GMT 2004


Could you post a bug report to gcc.gnu.org/bugzilla?

Thanks

Bryce


DHollenbeck wrote:

> On x86 linux 2.6.x using gcc 3.4.2 or 3.4.1 the -Os option causes a 
> bad libgcj.so.5.0.0 image to be built.
>
> The symptom of the problem is a NullPointerException in Calendar 
> property file lookup, exhibited by the following program:
>
> ----------------------
>
> import java.text.SimpleDateFormat;
>
> public class Test
> {
>  public static void main( String[] args )
>  {
>    System.out.println("before");  System.out.flush();
>
>    SimpleDateFormat dateFormatter =
>                new SimpleDateFormat( "yy-MMM-dd HH:mm" );
>
>    System.out.println("after");  System.out.flush();
>  }
> }
>
> --------------
>
> Running the above program with the bad libgcj.so.5.0.0 gives the
>
> "before"
>
> output, then the NullPointerException somewhere in the Calendar 
> property file lookup.
>
> If you build the libgcj with "-g3 -O2" instead of "-g3 -O2", then all 
> is well.
>
> --------------
>
> $ gcj Test.java -o test.prog --main=Test
>
> Here is my configure script:
>
> --------------
>
> #!/bin/sh
>
> # See this URL for instructions on what this all means:
> # http://gcc.gnu.org/install/
>
> GCJFLAGS="-g3 -O2"        # works ok
> #GCJFLAGS="-g3 -Os"       # causes NullPointerException in Test.java
>
>
> #SRCDIR=/rt/gcc-3.4.1
> SRCDIR=/rt/gcc-3.4.2
> #SRCDIR=/rt/gcc-4.0-20040919
>
> if [ -z $BUILDDIR ]; then
>    BUILDDIR=gccbuild
> fi
>
> if [ ! -e $BUILDDIR ]; then
>    mkdir $BUILDDIR
> fi
>
> PWD=`pwd`
> cd $BUILDDIR
>
> if [ "$1" = "distclean" ]; then
>    shift
>    make distclean
>    find . -name config.cache -exec rm -f {} \;
> fi
>
> if [ "$1" = "configure" ]; then
>    shift
>    $SRCDIR/configure -v --enable-languages=c,c++,java \
>    --prefix=/rt/gcc --enable-threads=posix \
>    --with-system-zlib --enable-nls --without-included-gettext \
>    --enable-libgcj-debug \
>    --enable-__cxa_atexit --enable-clocale=gnu \
>    --without-x --disable-java-awt --disable-gtk-cairo --with-gnu-ld \
>    i486-linux
> fi
>
> if [ "$1" = "build" ]; then
>    shift
>    make  GCJFLAGS="$GCJFLAGS" \
>       LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap
> fi
>
> if [ "$1" = "install" ]; then
>    shift
>    make install
> fi
>
> cd $PWD
>
>



More information about the Java mailing list