[patch] Promote xImode types to int

Andreas Jaeger aj@suse.de
Sun Sep 16 10:59:00 GMT 2001


Roman Lechtchinsky <rl@cs.tu-berlin.de> writes:

> On Sat, 15 Sep 2001, Richard Henderson wrote:
> > > 	* c-common.c (c_promoting_integer_type_p): Handle ?Imode types.
>> 
>> Applied.
>
> Unfortunately, this breaks libjava (got an email from the regression
> tester). Apparently, special java types (__java_byte etc.) defined in the
> C++ frontend shouldn't be promoted to int. Would you mind reverting this
> patch and installing the first version? I didn't see this failure because
> building libjava is apparently disabled on sparc-sun-solaris; I'm going to
> reenable it for future tests.

Are you sure that the code in libjava is correct?  I would propose the
following (I only tested that it compiles and will do a proper
bootstrap now) patch.

Andreas

2001-09-16  Andreas Jaeger  <aj@suse.de>

        * jni.cc (array_from_valist): Use promoted types for va_arg.

--- libjava/jni.cc.~1~	Mon Aug 20 22:18:05 2001
+++ libjava/jni.cc	Sun Sep 16 19:48:41 2001
@@ -656,9 +656,9 @@
   for (int i = 0; i < arg_types->length; ++i)
     {
       if (arg_elts[i] == JvPrimClass (byte))
-	values[i].b = va_arg (vargs, jbyte);
+	values[i].b = (jbyte)va_arg (vargs, int);
       else if (arg_elts[i] == JvPrimClass (short))
-	values[i].s = va_arg (vargs, jshort);
+	values[i].s = (jshort) va_arg (vargs, int);
       else if (arg_elts[i] == JvPrimClass (int))
 	values[i].i = va_arg (vargs, jint);
       else if (arg_elts[i] == JvPrimClass (long))
@@ -668,9 +668,9 @@
       else if (arg_elts[i] == JvPrimClass (double))
 	values[i].d = va_arg (vargs, jdouble);
       else if (arg_elts[i] == JvPrimClass (boolean))
-	values[i].z = va_arg (vargs, jboolean);
+	values[i].z = (jboolean)va_arg (vargs, int);
       else if (arg_elts[i] == JvPrimClass (char))
-	values[i].c = va_arg (vargs, jchar);
+	values[i].c = (jchar) va_arg (vargs, int);
       else
 	{
 	  // An object.

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj



More information about the Java-patches mailing list