Bug 36434 - incomplete implementation of printf()/format()
incomplete implementation of printf()/format()
Status: RESOLVED DUPLICATE of bug 32809
Product: classpath
Classification: Unclassified
Component: classpath
0.96
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-04 13:32 UTC by Debian GCC Maintainers
Modified: 2008-06-15 22:19 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2008-06-04 13:32:19 UTC
[forwarded from http://bugs.debian.org/478886]

seen with GCC-4.3 branch

  Matthias

the gnu classpath libraries cannot handle %f in format strings:

$ cat test.java
public class test {

public static void main (String[] args) {
System.out.printf("%09.3f%n",3.1415926535);
}

}
$ cat test2.java
public class test2 {

public static void main (String[] args) {
System.out.printf("%9.3f%n",3.1415926535);
}

}
$ gcj -C -g -O test.java
$ gcj -C -g -O test2.java
$ gij --version
java version "1.5.0"
gij (GNU libgcj) version 4.3.1 20080309 (prerelease)

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gij test
Exception in thread "main" java.lang.NumberFormatException: invalid character at position 2 in 09
   at java.lang.Integer.parseInt(libgcj.so.90)
   at java.lang.Integer.decode(libgcj.so.90)
   at java.util.Formatter.parseInt(libgcj.so.90)
   at java.util.Formatter.parseArgumentIndex(libgcj.so.90)
   at java.util.Formatter.format(libgcj.so.90)
   at java.util.Formatter.format(libgcj.so.90)
   at java.io.PrintStream.format(libgcj.so.90)
   at java.io.PrintStream.format(libgcj.so.90)
   at java.io.PrintStream.printf(libgcj.so.90)
   at test.main(test.java:4)
$ gij test2

$ scp test.class [host]:
Enter passphrase for key '[x]':
test.class                                                                                100%  639     0.6KB/s   00:00
$ scp test2.class [host]:
Enter passphrase for key '[x]':
test2.class                                                                               100%  639     0.6KB/s   00:00
$ ssh [host]
Enter passphrase for key '[x]':
$ java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05)
Java HotSpot(TM) Client VM (build 1.5.0_13-b05, mixed mode, sharing)
$ java test
00003.142
$ java test2
    3.142
Comment 1 Andrew John Hughes 2008-06-15 22:19:43 UTC

*** This bug has been marked as a duplicate of 32809 ***