summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-19 12:44:07 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-19 12:44:07 +0000
commit8ee14c01c788aa62e6c8d827671f5f863ffc2acb (patch)
tree372576e808dcf6f9e2490f5a2e6ba5a3d1d5cc9f /gcc
parent27b3429ec547e46528d995943101627bb669d935 (diff)
downloadgcc-8ee14c01c788aa62e6c8d827671f5f863ffc2acb.tar.gz
2012-04-19 Richard Guenther <rguenther@suse.de>
* ira-int.h (ira_allocno_object_iter_cond): Avoid out-of-bound array access. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186590 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ira-int.h9
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 086b8136f50..5d127ca9e87 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-19 Richard Guenther <rguenther@suse.de>
+
+ * ira-int.h (ira_allocno_object_iter_cond): Avoid out-of-bound
+ array access.
+
2012-04-19 Georg-Johann Lay <avr@gjlay.de>
PR target/53033
diff --git a/gcc/ira-int.h b/gcc/ira-int.h
index 24976d0418c..5db2ccc268c 100644
--- a/gcc/ira-int.h
+++ b/gcc/ira-int.h
@@ -1138,8 +1138,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