Strange, elusive bug in boolean return values with latest fetch from cvs

Scott Gilbertson scottg@mantatest.com
Fri Jun 4 17:24:00 GMT 2004


I just fetched the latest gcc from cvs, and ran through my application
looking for anything which no longer worked (the last time was about
mid-March). Somewhat surprisingly, the xlib AWT peers seem to be working
just as before. I did, however, find one specific feature of my software
which no longer works. It's OK when executed in the gcj interpreter (on
linux), but the native-compiled version messes up.
I'm building and running on linux, with static linking. I'm compiling from
the same jar file I use when running interpreted (not directly from the
source code). I'm producing the class files with Sun's compiler (I ought to
change that approach, I know):
 gcj -O2 -c -o mts5000.o mts5000.jar
 gcj --main=Main -g -save-temps -o mts5000.bin Main.o \
 natMain.o VersionInfo.o [...defines, etc...] -static \
 -shared-libgcc -lstdc++ -lX11 mts5000.o
In the snippet of code below, the commented out version always returns false
(when native-compiled), as described in the comment. The replacement code
shown in the snippet works fine, even when compiled. To my eye both
versions should return the same value. I tried to make a small program
which exhibits the problem, but in the small program the thing always
worked.
Does anybody know of a bug injected since about mid-March which might cause
this sort of problem, or how to characterize and/or diagnose it so I can
report it properly?
The code snippet follows.
public final boolean isSelected ()
{
 /* FIXME: Figure out why the old version no longer works with gcj-compiled
 * code (works OK with gcj interpreter). The line below always
 * returns false when compiled, regardless of what value comes
 * back from buttonGroup.isSelected(). The new gcc/gcj was fetched
 * from cvs 2004年06月03日. The old one was from about mid-March, with
 * some libJava stuff modified since then.
 * return (buttonGroup==null) ? false : buttonGroup.isSelected (this);
 */
 boolean returnValue = false;
 if (buttonGroup != null)
 returnValue = buttonGroup.isSelected (this);
 return returnValue;
}


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /