diff options
author | Richard Biener <rguenther@suse.de> | 2020-01-22 12:38:12 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-01-22 12:38:12 +0100 |
commit | 2b85c0882205c31987ac26ffc49351a3af3b537c (patch) | |
tree | 3e990b8c6ea83b58521a2877b35fb9e665f82f7e /gcc/tree-ssa-structalias.c | |
parent | d80f0a8dc9c2e5886bb79bddee2674e1d3f9d105 (diff) | |
download | gcc-2b85c0882205c31987ac26ffc49351a3af3b537c.zip gcc-2b85c0882205c31987ac26ffc49351a3af3b537c.tar.gz gcc-2b85c0882205c31987ac26ffc49351a3af3b537c.tar.bz2 |
tree-optimization/93381 fix integer offsetting in points-to analysis
We were incorrectly assuming a merge operation is conservative enough
for not explicitely handled operations but we also need to consider
offsetting within fields when field-sensitive analysis applies.
2020-01-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/93381
* tree-ssa-structalias.c (find_func_aliases): Assume offsetting
throughout, handle all conversions the same.
* gcc.dg/torture/pr93381.c: New testcase.
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r-- | gcc/tree-ssa-structalias.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index f189f75..416a26c 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5008,11 +5008,12 @@ find_func_aliases (struct function *fn, gimple *origt) || code == FLOOR_MOD_EXPR || code == ROUND_MOD_EXPR) /* Division and modulo transfer the pointer from the LHS. */ - get_constraint_for_rhs (gimple_assign_rhs1 (t), &rhsc); - else if ((CONVERT_EXPR_CODE_P (code) - && !(POINTER_TYPE_P (gimple_expr_type (t)) - && !POINTER_TYPE_P (TREE_TYPE (rhsop)))) + get_constraint_for_ptr_offset (gimple_assign_rhs1 (t), + NULL_TREE, &rhsc); + else if (CONVERT_EXPR_CODE_P (code) || gimple_assign_single_p (t)) + /* See through conversions, single RHS are handled by + get_constraint_for_rhs. */ get_constraint_for_rhs (rhsop, &rhsc); else if (code == COND_EXPR) { @@ -5031,14 +5032,16 @@ find_func_aliases (struct function *fn, gimple *origt) ; else { - /* All other operations are merges. */ + /* All other operations are possibly offsetting merges. */ auto_vec<ce_s, 4> tmp; struct constraint_expr *rhsp; unsigned i, j; - get_constraint_for_rhs (gimple_assign_rhs1 (t), &rhsc); + get_constraint_for_ptr_offset (gimple_assign_rhs1 (t), + NULL_TREE, &rhsc); for (i = 2; i < gimple_num_ops (t); ++i) { - get_constraint_for_rhs (gimple_op (t, i), &tmp); + get_constraint_for_ptr_offset (gimple_op (t, i), + NULL_TREE, &tmp); FOR_EACH_VEC_ELT (tmp, j, rhsp) rhsc.safe_push (*rhsp); tmp.truncate (0); |