gcj bug with locale (was: gcj with date manip. ...)

Maurice DIAMANTINI diam@ensta.fr
Thu Mar 8 08:18:00 GMT 2001


So because I had a problem with gcj-2.97, I've finaly been
able to build a version of gcc-3.0 both on linuppc
(with  --enable-languages=c++,java) and and linux intel
(with  --enable-languages=c++,java,f77)


But the same error occured when using Date.toString() method.


This result occured on linux distribution (both intel anf
linuxppc) with the following locale in my .cshrc: 

    setenv  LC_ALL   fr_FR

but all work fine if all replace this with:

    setenv  LC_ALL   en_US.iso-8859-1

But now, all my application menu are in english
(and as you can see, I'm not very clever in english :-)

I think this is a bug from gcc which should use default
locale such as "en_US.iso-8859-1" in replacement of
"fr_FR.iso-8859-1"  instead of rising an exception.

But now, I can keep on working with gcj instead of javac...
Thank you very much!


##############################################################
If you are yet interested by this problem, here
is the full trace af it :


--------------------------------------------------------------
Here is the program (about the same than previous):

import java.util.*;
import java.text.SimpleDateFormat;
public class Test  {    
    public static void main(String[] args) {
        // this work
        Date date = new Date();
        System.out.println ("getTime=" + date.getTime());
        // this doesn't work
        System.out.println ("date=" + date.toString());
        // this doesn't work neither !!
        SimpleDateFormat df = 
              new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.SSSS");
        System.out.println ("Début à : " + df.format(date) );
        return;
    }
}

------------------------------------------------------------
Here is the jdk result:

>javac Test.java && java Test

    getTime=984043770064
    date=Thu Mar 08 10:29:30 CET 2001
    Début à : 2001-03-08 10:29:30.0064
    
------------------------------------------------------------
Here is the gcj result:

>gcj -O0 -g   --main=Test -o test Test.java
(nota: make .class first, the making test rise the same error)



I replace "/usr/local/pack/gcc-3.0-cvs-20010306/powerpc-linux/" 
by "//" for readability

./test 
getTime=984043880723
Exception in thread "main" java.lang.NullPointerException
   at 0x0fd0dfb0: java.lang.Throwable.Throwable()
        (//lib/libgcj.so.1)
   at 0x0fcf9780: java.lang.Exception.Exception()
        (//lib/libgcj.so.1)
   at 0x0fcfffb8: java.lang.RuntimeException.RuntimeException()
        (//lib/libgcj.so.1)
   at 0x0fcff408: java.lang.NullPointerException.NullPointerException()
        (//lib/libgcj.so.1)
   at 0x0fcb6824: _Jv_ThrowNullPointerException 
        (//lib/libgcj.so.1)
   at 0x0fdf364c: java.text.DateFormatSymbols.formatsForKey
      (java.util.ResourceBundle, java.lang.String)
        (//lib/libgcj.so.1)
   at 0x0fdf335c: java.text.DateFormatSymbols.DateFormatSymbols
      (java.util.Locale)
        (//lib/libgcj.so.1)
   at 0x0fd8d388: java.util.TimeZone.getDisplayName
      (boolean, int, java.util.Locale)
        (//lib/libgcj.so.1)
   at 0x0fd8d224: java.util.TimeZone.getDisplayName(boolean, int)
        (//lib/libgcj.so.1)
   at 0x0fe03d8c: java.text.SimpleDateFormat.format
     (java.util.Date, java.lang.StringBuffer, java.text.FieldPosition)
        (//lib/libgcj.so.1)
   at 0x0fdf1db8: java.text.DateFormat.format(java.util.Date)
        (//lib/libgcj.so.1)
   at 0x0fd7582c: java.util.Date.toString()
        (//lib/libgcj.so.1)
   at 0x10000f70: Test.main(java.lang.String[]) 
     (/home/diam/projets/jorlab/benchs_java/testbug/Test.java:15)
   at 0x0fcd9374: gnu.gcj.runtime.FirstThread.run()
        (//lib/libgcj.so.1)
   at 0x0fce7b08: java.lang.Thread.run_(java.lang.Object)
        (//lib/libgcj.so.1)
   at 0x0fe98e2c: _Jv_ThreadSetPriority(_Jv_Thread_t, int)
        (//lib/libgcj.so.1)
   at 0x0fa1f910: GC_start_routine (//lib/libgcjgc.so.1)
   at 0x0f9e3adc: pthread_detach (/lib/libpthread.so.0)
   at 0x0f91d9fc: __clone (/lib/libc.so.6)


------------------------------------------------------------------------
Then Here the result from gdb


----------------------------
A - If dynamicaly compiled :

(gdb) run
Starting program: /home/diam/projets/jorlab/benchs_java/testbug/test 
/home/diam/projets/jorlab/benchs_java/testbug/test: error in loading shared libraries: libgcc_s.so.0: cannot open shared object file: No such file or directory

Program exited with code 0177.

But the LB_LIBRARY_PATH is well set!!!



----------------------------
B - So I compiled with -static 
    (and setenv CLASSPATH  .../share/libgcj.jar)

> Gdb test 
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-unknown-linux-gnu"...

(gdb) run
Starting program: /home/diam/projets/jorlab/benchs_java/testbug/test 
[New Thread 26812 (manager thread)]
[New Thread 26771 (initial thread)]
[New Thread 26813]
getTime=984044383684

Program received signal SIGPWR, Power fail/restart.
0x10128608 in __syscall_rt_sigsuspend () at herrno.c:33
33      herrno.c: Aucun fichier ou répertoire de ce type.

(gdb) list
28      in herrno.c
(gdb) 


./
-- 
Maurice.Diamantini@ensta.fr       -       ENSTA/LMA
École Nationale Supérieure  de  Techniques Avancées
 Laboratoire    de     Mathématiques    Appliquées 
     http://www.ensta.fr/~diam



More information about the Java mailing list