]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR java/31842 (r124338 causes java Divide_1 and pr6388 to fail)
authorRichard Guenther <rguenther@suse.de>
Sun, 9 Sep 2007 20:12:56 +0000 (20:12 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 9 Sep 2007 20:12:56 +0000 (20:12 +0000)
2007-09-09  Richard Guenther  <rguenther@suse.de>

Backport from mainline:
2007-05-07  Ian Lance Taylor  <iant@google.com>

PR java/31842
* java/lang/natString.cc (_Jv_FormatInt): Avoid undefined signed
overflow.

From-SVN: r128306

libjava/ChangeLog
libjava/java/lang/natString.cc

index 5fb6562b4de54090906ce27744277fd59667a320..e0162ca7d71510008091ac3c9d9c9065f0177790 100644 (file)
@@ -1,3 +1,12 @@
+2007-09-09  Richard Guenther  <rguenther@suse.de>
+
+       Backport from mainline:
+       2007-05-07  Ian Lance Taylor  <iant@google.com>
+
+       PR java/31842
+       * java/lang/natString.cc (_Jv_FormatInt): Avoid undefined signed
+       overflow.
+
 2007-02-13  Release Manager
 
        * GCC 4.1.2 released.
index 3f630812d5ef478db610f70ed568cbbbf68b4244..3cca5176d0bb15d2cfaceef8fe96d0bac541f76b 100644 (file)
@@ -371,11 +371,11 @@ _Jv_FormatInt (jchar* bufend, jint num)
   if (num < 0)
     {
       isNeg = true;
-      num = -(num);
-      if (num < 0)
+      if (num != (jint) -2147483648U)
+       num = -(num);
+      else
        {
-         // Must be MIN_VALUE, so handle this special case.
-         // FIXME use 'unsigned jint' for num.
+         // Handle special case of MIN_VALUE.
          *--ptr = '8';
          num = 214748364;
        }