diff options
author | Richard Guenther <rguenther@suse.de> | 2008-01-08 21:35:25 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-01-08 21:35:25 +0000 |
commit | 3fe2f42a2ca104d568298fa5141f86bee2f8163a (patch) | |
tree | b045b940e8c675ad52a8a9376cfb9fe0fcc7abc0 /gcc/tree-ssa-structalias.c | |
parent | 416a8af4dae6f8d204e168fd3137cc74238860a0 (diff) | |
download | gcc-3fe2f42a2ca104d568298fa5141f86bee2f8163a.zip gcc-3fe2f42a2ca104d568298fa5141f86bee2f8163a.tar.gz gcc-3fe2f42a2ca104d568298fa5141f86bee2f8163a.tar.bz2 |
re PR c++/31863 (g++-4.1: out of memory with -O1/-O2)
2008-01-08 Richard Guenther <rguenther@suse.de>
PR middle-end/31863
* tree-ssa-structalias.c (push_fields_onto_fieldstack): Bail
out early if the result will be unused.
* g++.dg/torture/pr31863.C: New testcase.
From-SVN: r131405
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r-- | gcc/tree-ssa-structalias.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 5e197c4..70a9d32 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4062,7 +4062,13 @@ push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack, { tree field; int count = 0; - int first_element = VEC_length (fieldoff_s, *fieldstack); + unsigned int first_element = VEC_length (fieldoff_s, *fieldstack); + + /* If the vector of fields is growing too big, bail out early. + Callers check for VEC_length <= MAX_FIELDS_FOR_FIELD_SENSITIVE, make + sure this fails. */ + if (first_element > MAX_FIELDS_FOR_FIELD_SENSITIVE) + return 0; if (TREE_CODE (type) == COMPLEX_TYPE) { |