diff options
author | Richard Biener <rguenther@suse.de> | 2020-03-18 09:13:17 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-03-18 09:14:48 +0100 |
commit | 4e3d3e40726e1b68bf52fa205c68495124ea60b8 (patch) | |
tree | c40b5b145bca1448d3196a5857b9fd30bbd77c8f /gcc/tree-ssa-strlen.c | |
parent | af8656be8df68ac26840f7844430fd595255ebd2 (diff) | |
download | gcc-4e3d3e40726e1b68bf52fa205c68495124ea60b8.zip gcc-4e3d3e40726e1b68bf52fa205c68495124ea60b8.tar.gz gcc-4e3d3e40726e1b68bf52fa205c68495124ea60b8.tar.bz2 |
middle-end/94188 fix fold of addr expression generation
This adds a missing type conversion to build_fold_addr_expr and adjusts
fallout - build_fold_addr_expr was used as a convenience to build an
ADDR_EXPR but some callers do not expect the result to be simplified
to something else.
2020-03-18 Richard Biener <rguenther@suse.de>
PR middle-end/94188
* fold-const.c (build_fold_addr_expr): Convert address to
correct type.
* asan.c (maybe_create_ssa_name): Strip useless type conversions.
* gimple-fold.c (gimple_fold_stmt_to_constant_1): Use build1
to build the ADDR_EXPR which we don't really want to simplify.
* tree-ssa-dom.c (record_equivalences_from_stmt): Likewise.
* tree-ssa-loop-im.c (gather_mem_refs_stmt): Likewise.
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Likewise.
(simplify_builtin_call): Strip useless type conversions.
* tree-ssa-strlen.c (new_strinfo): Likewise.
* gcc.dg/pr94188.c: New testcase.
Diffstat (limited to 'gcc/tree-ssa-strlen.c')
-rw-r--r-- | gcc/tree-ssa-strlen.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index df4c1b6..f883a1f 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -57,9 +57,9 @@ along with GCC; see the file COPYING3. If not see #include "cfgloop.h" #include "tree-ssa-loop.h" #include "tree-scalar-evolution.h" - #include "vr-values.h" #include "gimple-ssa-evrp-analyze.h" +#include "tree-ssa.h" /* A vector indexed by SSA_NAME_VERSION. 0 means unknown, positive value is an index into strinfo vector, negative value stands for @@ -679,6 +679,7 @@ new_strinfo (tree ptr, int idx, tree nonzero_chars, bool full_string_p) { strinfo *si = strinfo_pool.allocate (); si->nonzero_chars = nonzero_chars; + STRIP_USELESS_TYPE_CONVERSION (ptr); si->ptr = ptr; si->stmt = NULL; si->alloc = NULL; |