]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/54638 (bootstraping 4.7.2 with 4.8 broken: cc1: malloc(): memory...
authorRichard Guenther <rguenther@suse.de>
Fri, 21 Sep 2012 10:09:04 +0000 (10:09 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 21 Sep 2012 10:09:04 +0000 (10:09 +0000)
2012-09-21  Richard Guenther  <rguenther@suse.de>

PR middle-end/54638
Backport from mainline
2012-04-19  Richard Guenther  <rguenther@suse.de>

* ira-int.h (ira_allocno_object_iter_cond): Avoid out-of-bound
array access.

From-SVN: r191606

gcc/ChangeLog
gcc/ira-int.h

index f77a5c8602041e66500d56e76c38821279831dbb..29065b818b1bf4cc41960f2ac7e0ce91f475a20a 100644 (file)
@@ -1,3 +1,12 @@
+2012-09-21  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/54638
+       Backport from mainline
+       2012-04-19  Richard Guenther  <rguenther@suse.de>
+
+       * ira-int.h (ira_allocno_object_iter_cond): Avoid out-of-bound
+       array access.
+
 2012-09-15  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/54552
index 049a07f89d5b5d5859858b96516b007f82068991..a58f0ca0c904f8b81363441d1974b95ac2df27c6 100644 (file)
@@ -1123,8 +1123,13 @@ static inline bool
 ira_allocno_object_iter_cond (ira_allocno_object_iterator *i, ira_allocno_t a,
                              ira_object_t *o)
 {
-  *o = ALLOCNO_OBJECT (a, i->n);
-  return i->n++ < ALLOCNO_NUM_OBJECTS (a);
+  int n = i->n++;
+  if (n < ALLOCNO_NUM_OBJECTS (a))
+    {
+      *o = ALLOCNO_OBJECT (a, n);
+      return true;
+    }
+  return false;
 }
 
 /* Loop over all objects associated with allocno A.  In each