diff options
author | Richard Biener <rguenther@suse.de> | 2013-02-20 11:39:39 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-02-20 11:39:39 +0000 |
commit | e91c8ed63fa4d372a740ca8047bf42c0b86593c4 (patch) | |
tree | a9f201aa86270f426a1e1a693b80027bb5c40590 /gcc/tree-ssa-ccp.c | |
parent | 3d916479cf3b6ec9a2a81fece2996a54ebb314c3 (diff) | |
download | gcc-e91c8ed63fa4d372a740ca8047bf42c0b86593c4.zip gcc-e91c8ed63fa4d372a740ca8047bf42c0b86593c4.tar.gz gcc-e91c8ed63fa4d372a740ca8047bf42c0b86593c4.tar.bz2 |
re PR tree-optimization/56396 (memory corruption in cc1)
2013-02-20 Richard Biener <rguenther@suse.de>
Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/56396
* tree-ssa-ccp.c (n_const_val): New static variable.
(get_value): Return NULL for SSA names we don't have a lattice
entry for.
(ccp_initialize): Initialize n_const_val.
* tree-ssa-copy.c (n_copy_of): New static variable.
(init_copy_prop): Initialize n_copy_of.
(get_value): Return NULL_TREE for SSA names we don't have a
lattice entry for.
* gcc.dg/pr56396.c: New testcase.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r196170
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r-- | gcc/tree-ssa-ccp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index d8f03a1..b4faded 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -162,6 +162,7 @@ typedef struct prop_value_d prop_value_t; memory reference used to store (i.e., the LHS of the assignment doing the store). */ static prop_value_t *const_val; +static unsigned n_const_val; static void canonicalize_float_value (prop_value_t *); static bool ccp_fold_stmt (gimple_stmt_iterator *); @@ -295,7 +296,8 @@ get_value (tree var) { prop_value_t *val; - if (const_val == NULL) + if (const_val == NULL + || SSA_NAME_VERSION (var) >= n_const_val) return NULL; val = &const_val[SSA_NAME_VERSION (var)]; @@ -713,7 +715,8 @@ ccp_initialize (void) { basic_block bb; - const_val = XCNEWVEC (prop_value_t, num_ssa_names); + n_const_val = num_ssa_names; + const_val = XCNEWVEC (prop_value_t, n_const_val); /* Initialize simulation flags for PHI nodes and statements. */ FOR_EACH_BB (bb) |