diff options
author | Richard Biener <rguenther@suse.de> | 2019-07-31 14:38:21 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-07-31 14:38:21 +0000 |
commit | 208149b7201420d965991e08cb4e4c261171b0a2 (patch) | |
tree | 95dce03118e2b3393eff7e3602cd0ffdef245560 /gcc/tree-ssa-structalias.c | |
parent | a28351e7f54cb63ed19e2fa67de8f91101260d94 (diff) | |
download | gcc-208149b7201420d965991e08cb4e4c261171b0a2.zip gcc-208149b7201420d965991e08cb4e4c261171b0a2.tar.gz gcc-208149b7201420d965991e08cb4e4c261171b0a2.tar.bz2 |
re PR tree-optimization/91280 (ICE in get_constraint_for_component_ref, at tree-ssa-structalias.c:3259 since r260354)
2019-07-31 Richard Biener <rguenther@suse.de>
PR tree-optimization/91280
* tree-ssa-structalias.c (get_constraint_for_component_ref):
Decompose MEM_REF manually for offset handling.
* g++.dg/torture/pr91280.C: New testcase.
From-SVN: r273936
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r-- | gcc/tree-ssa-structalias.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 974b639..75c6fae 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -3289,9 +3289,29 @@ get_constraint_for_component_ref (tree t, vec<ce_s> *results, return; } - /* Pretend to take the address of the base, we'll take care of - adding the required subset of sub-fields below. */ - get_constraint_for_1 (t, results, true, lhs_p); + /* Avoid creating pointer-offset constraints, so handle MEM_REF + offsets directly. Pretend to take the address of the base, + we'll take care of adding the required subset of sub-fields below. */ + if (TREE_CODE (t) == MEM_REF + && !integer_zerop (TREE_OPERAND (t, 0))) + { + poly_offset_int off = mem_ref_offset (t); + off <<= LOG2_BITS_PER_UNIT; + off += bitpos; + poly_int64 off_hwi; + if (off.to_shwi (&off_hwi)) + bitpos = off_hwi; + else + { + bitpos = 0; + bitmaxsize = -1; + } + get_constraint_for_1 (TREE_OPERAND (t, 0), results, false, lhs_p); + do_deref (results); + } + else + get_constraint_for_1 (t, results, true, lhs_p); + /* Strip off nothing_id. */ if (results->length () == 2) { |