This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Strange, elusive bug in boolean return values with latest fetch from cvs
Scott Gilbertson writes:
> > Simplest for us would be if you made a small self-contained program
> > which we could run which prints a clearly incorrect result.
>
> I had to mess with it for a while, but I got a small test case to exhibit
> the problem. I compiled BugJune3.java using the attached mkbj3 script,
> producing the executable BugJune3.dynamic. Running it, I get:
> bug.seeIfItsTrue returned false
> bug.seeIfItsTrue returned false
> It should be:
> bug.seeIfItsTrue returned false
> bug.seeIfItsTrue returned true
> If you compile straight from the java source, it's fine (the problem occurs
> when compiling to a native binary from class files). If you interpret it
> (either with Sun or gcj), it's fine. If you change the optimization level
> from -O2 to -O0, it always returns true instead of always returning false.
>
> Before I got the test case to work, I did some disassembly to investigate
> the problem. Details follow...
>
> Here is the functional version of the code (i.e. it works as expected, even
> when compiled to a native binary):
Hmm, I can't duplicate your test case. I didn't recompile the class files.
zorro:/tmp $ LD_LIBRARY_PATH=~/gcc/install/lib64/ ./BugJune3.dynamic
bug.seeIfItsTrue returned false
bug.seeIfItsTrue returned true
zorro:/tmp $ gcj -g -O2 -c -o BugJune3.o BugJune3*.class
zorro:/tmp $ LD_LIBRARY_PATH=~/gcc/install/lib64/ ./BugJune3.dynamic
bug.seeIfItsTrue returned false
bug.seeIfItsTrue returned true
Andrew.