aboutsummaryrefslogtreecommitdiff
path: root/gcc/ira-int.h
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-04-19 12:44:07 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-04-19 12:44:07 +0000
commitd0a854af24839f665a04eaeb3f828c79587568cc (patch)
tree372576e808dcf6f9e2490f5a2e6ba5a3d1d5cc9f /gcc/ira-int.h
parent20955f5acf05cd84927826a268caa847abfe3a6d (diff)
downloadgcc-d0a854af24839f665a04eaeb3f828c79587568cc.zip
gcc-d0a854af24839f665a04eaeb3f828c79587568cc.tar.gz
gcc-d0a854af24839f665a04eaeb3f828c79587568cc.tar.bz2
ira-int.h (ira_allocno_object_iter_cond): Avoid out-of-bound array access.
2012-04-19 Richard Guenther <rguenther@suse.de> * ira-int.h (ira_allocno_object_iter_cond): Avoid out-of-bound array access. From-SVN: r186590
Diffstat (limited to 'gcc/ira-int.h')
-rw-r--r--gcc/ira-int.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/ira-int.h b/gcc/ira-int.h
index 24976d0..5db2ccc 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