This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
jboolean is an unsigned type
- From: Andrew Haley <aph at redhat dot com>
- To: Mathieu Malaterre <mathieu dot malaterre at gmail dot com>
- Cc: Florian Weimer <fw at deneb dot enyo dot de>, GCJ-patches <java-patches at gcc dot gnu dot org>
- Date: Wed, 24 Feb 2010 15:33:52 +0000
- Subject: jboolean is an unsigned type
- References: <bf0c3b3f0907160537g2b52ccf8ydd39df0d2ae54e3c@mail.gmail.com> <87ab31nrc2.fsf@mid.deneb.enyo.de> <4A62D0B7.6010301@redhat.com> <87eisddr3y.fsf@mid.deneb.enyo.de> <4A6338DE.7040700@redhat.com> <bf0c3b3f0907210016w50a4201oebec02bb77ecba3e@mail.gmail.com> <4A6572E0.2060006@redhat.com> <bf0c3b3f0907210144g51dc6861nad9b29574e43ac93@mail.gmail.com>
This fixes a bug that goes back many, many years.
Inside the compiler jboolean is an unsigned type, but in the library
jboolean is a signed type. We got away with this by accident.
I've done a fair bit of testing, and I'm pretty sure this won't break
any BC-compiled programs: none of the signatures change, for example.
It is possible that some CNI programs that hitherto have worked by
accident will break; we'll see.
Andrew.
2010-02-24 Andrew Haley <aph@redhat.com>
PR java/40816
* include/jni_md.h: jboolean is an unsigned type.
Index: include/jni_md.h
===================================================================
--- include/jni_md.h (revision 157011)
+++ include/jni_md.h (working copy)
@@ -78,7 +78,7 @@
typedef int jshort __attribute__((__mode__(__HI__)));
typedef int jint __attribute__((__mode__(__SI__)));
typedef int jlong __attribute__((__mode__(__DI__)));
-typedef int jboolean __attribute__((__mode__(__QI__)));
+typedef unsigned int jboolean __attribute__((__mode__(__QI__)));
typedef unsigned short jchar __attribute__((__mode__(__HI__)));
typedef float jfloat;
typedef double jdouble;
@@ -99,7 +99,7 @@
typedef float jfloat;
typedef double jdouble;
typedef jint jsize;
-typedef int8_t jboolean;
+typedef uint8_t jboolean;
typedef uint16_t jchar;
# else /* JV_HAVE_INTTYPES_H */