Java compiler lossage
Tim Van Holder
zastai@hotmail.com
Fri May 26 00:26:00 GMT 2000
GCC Version: 2.95.2
System: i386-pc-msdosdjgpp
Problem: Serious lossage in the Java compiler (and libgcj).
Issues:
* No proper DOS support. DOS has a case-insensitive filesystem, so for
DOS platforms, stricmp/strnicmp should be used instead of strcmp/strncmp
to check paths.
* gcj should not always pass '-g1' if no -g option is given; if gcc is set
up
to emit SDB (coff) debugging by default, the compiler will generate
debugging info GAS (including recent snapshots) can't grok.
Example: gnu/gcj/convert/BytesToUnicode.java
Command line: gcj -gcoff1 -c BytesToUnicode.java
Output and corresponding lines:
----
1188: Error: Rest of line ignored. First ignored character is `['.
-> .def _byte[]; .scl 10; .type 010; .size 12; .endef
1191: Error: Rest of line ignored. First ignored character is `['.
-> .def .eos; .val 12; .scl 102; .tag _byte[]; .size 12; .endef
1194: Error: Rest of line ignored. First ignored character is `['.
-> .def _inbuffer; .val 8; .scl 8; .tag _byte[]; .size 12; .type 030; .endef
----
Solution: default to -gstabs+1 if stabs is supported, or fix GAS so it
accepts square brackets.
* ResourceBundle.java (part of libgcj) wouldn't compile if -O is given; with
-O1
it generated an internal compiler error, and with any other level it
froze (which on my system often indicates a stack overflow).
Now I have recompiled the GCC suite using a recent snapshot of binutils
(with support for weak symbols), using -Os will cause jc1 to freeze and
using any numbered -O option will always generate a SIGSEGV:
----
ResourceBundle.java: In class `java.util.ResourceBundle':
ResourceBundle.java: In method
`trySomeGetBundle(java.lang.String,java.lang.String)':
ResourceBundle.java:142: Exiting due to signal SIGSEGV
----
* BigInteger.java (part of libgcj) can't generate a class file:
----
BigInteger.java: In class `java.math.BigInteger':
BigInteger.java: In method `isNegative()':
BigInteger.java:283: internal error - SP mismatch
----
However if this:
----
private final boolean isNegative()
{
return (words == null ? ival : words[ival - 1]) < 0;
}
----
is replaced by this less efficient, but equivalent code:
----
private final boolean isNegative()
{
if(words == null) return (ival < 0);
else return (words[ival - 1] < 0);
}
----
it works just fine.
<This bug has also been submitted to the libjava bug list>
* If libgcj.a is built with optimization, gij and jv-convert won't link:
Affected files:
java/lang/Class.java
-> if -O3 or higher is used, hackTrampoline and checkMemberAccess are
no
longer present in the object file.
Probable cause: -O3 turns on -finline-functions, and the Java compiler
incorrectly inlines them
java/util/GregorianCalendar.java
java/util/TimeZone.java
java/util/zip/ZipEntry.java
-> These miss LJv0, LJv1, ... entries if optimizing; -O0 is required.
<This bug has also been submitted to the libjava bug list>
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
More information about the Gcc-bugs
mailing list