aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-structalias.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-10-26 12:21:50 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-10-26 12:21:50 +0000
commitbd02b3a0c9223cecb7ec0367ecae6c76bbcd9b50 (patch)
tree4d400d86739da09b9752ad1ee96ecb874a70857b /gcc/tree-ssa-structalias.c
parentb77a0698b4fbd971ee15b79afc6d20edce491dab (diff)
downloadgcc-bd02b3a0c9223cecb7ec0367ecae6c76bbcd9b50.zip
gcc-bd02b3a0c9223cecb7ec0367ecae6c76bbcd9b50.tar.gz
gcc-bd02b3a0c9223cecb7ec0367ecae6c76bbcd9b50.tar.bz2
re PR tree-optimization/41826 (invalid read in get_constraint_for_ptr_offset)
2009-10-26 Richard Guenther <rguenther@suse.de> PR tree-optimization/41826 * tree-ssa-structalias.c (get_constraint_for_ptr_offset): Avoid access to re-allocated vector fields. From-SVN: r153550
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r--gcc/tree-ssa-structalias.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index e5f4a29..cc655df 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -2825,7 +2825,7 @@ static void
get_constraint_for_ptr_offset (tree ptr, tree offset,
VEC (ce_s, heap) **results)
{
- struct constraint_expr *c;
+ struct constraint_expr c;
unsigned int j, n;
HOST_WIDE_INT rhsunitoffset, rhsoffset;
@@ -2863,14 +2863,14 @@ get_constraint_for_ptr_offset (tree ptr, tree offset,
for (j = 0; j < n; j++)
{
varinfo_t curr;
- c = VEC_index (ce_s, *results, j);
- curr = get_varinfo (c->var);
+ c = *VEC_index (ce_s, *results, j);
+ curr = get_varinfo (c.var);
- if (c->type == ADDRESSOF
+ if (c.type == ADDRESSOF
/* If this varinfo represents a full variable just use it. */
&& curr->is_full_var)
- c->offset = 0;
- else if (c->type == ADDRESSOF
+ c.offset = 0;
+ else if (c.type == ADDRESSOF
/* If we do not know the offset add all subfields. */
&& rhsoffset == UNKNOWN_OFFSET)
{
@@ -2881,13 +2881,13 @@ get_constraint_for_ptr_offset (tree ptr, tree offset,
c2.var = temp->id;
c2.type = ADDRESSOF;
c2.offset = 0;
- if (c2.var != c->var)
+ if (c2.var != c.var)
VEC_safe_push (ce_s, heap, *results, &c2);
temp = temp->next;
}
while (temp);
}
- else if (c->type == ADDRESSOF)
+ else if (c.type == ADDRESSOF)
{
varinfo_t temp;
unsigned HOST_WIDE_INT offset = curr->offset + rhsoffset;
@@ -2919,11 +2919,13 @@ get_constraint_for_ptr_offset (tree ptr, tree offset,
c2.offset = 0;
VEC_safe_push (ce_s, heap, *results, &c2);
}
- c->var = temp->id;
- c->offset = 0;
+ c.var = temp->id;
+ c.offset = 0;
}
else
- c->offset = rhsoffset;
+ c.offset = rhsoffset;
+
+ VEC_replace (ce_s, *results, j, &c);
}
}