diff options
author | Richard Biener <rguenther@suse.de> | 2013-11-18 15:25:05 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-11-18 15:25:05 +0000 |
commit | 1eadb567eff34df82355c8b5d56e32b76282bad2 (patch) | |
tree | 4fdadcce61fa5e47e03e25659386ced8080d70b9 /gcc/tree-ssa-sccvn.c | |
parent | 7d362f6c2b99e2b0cedf44e52194c578bdf00053 (diff) | |
download | gcc-1eadb567eff34df82355c8b5d56e32b76282bad2.zip gcc-1eadb567eff34df82355c8b5d56e32b76282bad2.tar.gz gcc-1eadb567eff34df82355c8b5d56e32b76282bad2.tar.bz2 |
re PR middle-end/59125 (gcc triggers wrong strncpy_chk)
2013-11-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/59125
PR tree-optimization/54570
* tree-ssa-sccvn.c (copy_reference_ops_from_ref): When inlining
is not complete do not treat component-references with offset zero
but different fields as equal.
* tree-object-size.c: Include tree-phinodes.h and ssa-iterators.h.
(compute_object_sizes): Apply TLC. Propagate the constant
results into all uses and fold their stmts.
* passes.def (pass_all_optimizations): Move pass_object_sizes
after the first pass_forwprop and before pass_fre.
* gcc.dg/builtin-object-size-8.c: Un-xfail.
* gcc.dg/builtin-object-size-14.c: New testcase.
* gcc.dg/strlenopt-14gf.c: Adjust.
* gcc.dg/strlenopt-1f.c: Likewise.
* gcc.dg/strlenopt-4gf.c: Likewise.
From-SVN: r204966
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 8742e26..26bb190 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -760,7 +760,7 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result) } /* For non-calls, store the information that makes up the address. */ - + tree orig = ref; while (ref) { vn_reference_op_s temp; @@ -810,7 +810,15 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result) + tree_to_double_int (bit_offset) .rshift (BITS_PER_UNIT == 8 ? 3 : exact_log2 (BITS_PER_UNIT)); - if (off.fits_shwi ()) + if (off.fits_shwi () + /* Probibit value-numbering zero offset components + of addresses the same before the pass folding + __builtin_object_size had a chance to run + (checking cfun->after_inlining does the + trick here). */ + && (TREE_CODE (orig) != ADDR_EXPR + || !off.is_zero () + || cfun->after_inlining)) temp.off = off.low; } } |