This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug java/14722] New: Bug in conversion to Unicode of command line arguments
- From: "John dot Downey at ftid dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 24 Mar 2004 18:28:16 -0000
- Subject: [Bug java/14722] New: Bug in conversion to Unicode of command line arguments
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This seems to be a bug in gcj 3.3.2 which only occurs on Solaris 8. I
don't think it happened on Solaris 7 (though I can't verify that any
more) and it doesn't happen on Linux. I don't have access to any other
systems that I can build GCC on.
It also doesn't happen with Sun's java interpreter on Solaris 8.
The problem is that, with a native executable built with gcj, the
first command-line argument is converted to Unicode in such a way that
it starts with a Unicode byte order mark (0xfeff, decimal 65279). This
tends to be confusing for programs that want to do command-line
argument processing, especially for options starting with '-'.
I apologize if this has been reported before, but I couldn't find it
on the bugs database.
Of course, this may well be a Sun bug, but whether they'll be prepared
to fix it for the sake of gcj is another question.
I hope this is enough information. I haven't run the compiler with
-save-temps because there are no include files involved.
Regards,
John Downey
Here are my results:
$ uname -a
SunOS gp003dev 5.8 Generic_108528-22 sun4u sparc SUNW,Ultra-Enterprise
$
$ gcj -v --encoding=UTF-8 --classpath= --main=showargs showargs.java
Reading specs from
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/specs
Reading specs from
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/../../../libgcj.spec
rename spec lib to liborig
Configured with: /home/exshutil/src/gcc-3.3.2/configure
--prefix=/home/exshutil/gcc3 --with-gnu-as --with-as=/home/exshutil/bin/as
--with-gnu-ld --with-ld=/home/exshutil/bin/ld --enable-languages=c,c++,java
--disable-multilib
Thread model: posix
gcc version 3.3.2
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/jc1 showargs.java
-fuse-divide-subroutine -fcheck-references -fuse-boehm-gc
-fkeep-inline-functions -quiet -dumpbase showargs.java -auxbase showargs -g1
-version -fencoding=UTF-8 -fclasspath= -o /var/tmp//ccSra4IQ.s
GNU Java version 3.3.2 (sparc-sun-solaris2.8)
compiled by GNU C version 3.3.2.
GGC heuristics: --param ggc-min-expand=65 --param ggc-min-heapsize=65536
Class path starts here:
./
/home/exshutil/gcc3/share/java/libgcj-3.3.2.jar/ (system) (zip)
/home/exshutil/bin/as --traditional-format -V -Qy -s -o /var/tmp//ccsPFruL.o
/var/tmp//ccSra4IQ.s
GNU assembler version 2.9.1 (sparc-sun-solaris2.7), using BFD version 2.9.1
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/jvgenmain
showargsmain /var/tmp//ccuNC3qK.i
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/cc1
/var/tmp//ccuNC3qK.i -quiet -dumpbase showargsmain.c -g1 -version
-fdollars-in-identifiers -o /var/tmp//ccSra4IQ.s
GNU C version 3.3.2 (sparc-sun-solaris2.8)
compiled by GNU C version 3.3.2.
GGC heuristics: --param ggc-min-expand=65 --param ggc-min-heapsize=65536
/home/exshutil/bin/as --traditional-format -V -Qy -s -o /var/tmp//ccg3eqmM.o
/var/tmp//ccSra4IQ.s
GNU assembler version 2.9.1 (sparc-sun-solaris2.7), using BFD version 2.9.1
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/collect2 -V -Y
P,/usr/ccs/lib:/usr/lib -Qy
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crt1.o
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crti.o
/usr/ccs/lib/values-Xa.o
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crtbegin.o
-L/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2 -L/usr/ccs/bin
-L/usr/ccs/lib
-L/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/../../..
/var/tmp//ccg3eqmM.o /var/tmp//ccsPFruL.o -lgcc_s -lgcc -lgcj -lm -lpthread -lrt
-lsocket -ldl -lgcc_s -lgcc -lc -lgcc_s -lgcc -lgcj -lm -lpthread -lrt -lsocket
-ldl -lgcc_s -lgcc -lc
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crtend.o
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crtn.o
GNU ld version 2.9.1 (with BFD 2.9.1)
Supported emulations:
elf32_sparc
$
$ cat showargs.java
import java.io.*;
import java.lang.*;
class
showargs
{
public static void
main(String args[])
{
for (int i = 0; i < args.length; i++)
{
String s = args[i];
if (i > 0)
System.err.print(' ');
System.err.print(s);
System.err.print(" (");
for (int j = 0; j < s.length(); j++)
{
if (j > 0)
System.err.print(' ');
System.err.print((int) s.charAt(j));
}
System.err.print(')');
}
System.err.println();
System.err.flush();
}
}
$
$ a.out x y z
?x (65279 120) y (121) z (122)
$
$ a.out -option
?-option (65279 45 111 112 116 105 111 110)
--
Summary: Bug in conversion to Unicode of command line arguments
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: John dot Downey at ftid dot com
CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
dot org
GCC build triplet: sparc-sun-solaris2.8
GCC host triplet: sparc-sun-solaris2.8
GCC target triplet: sparc-sun-solaris2.8
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14722