diff options
author | Martin Sebor <msebor@redhat.com> | 2018-06-13 20:29:04 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2018-06-13 14:29:04 -0600 |
commit | a7bf6c088934ef39a937069fca7408c7f540c551 (patch) | |
tree | 07550cd4b992b1eb84936c13801494f6fe66c2e1 /gcc/tree-ssa-strlen.c | |
parent | eb04ee1d0f23b14c251a850f2a26429d324b1f6f (diff) | |
download | gcc-a7bf6c088934ef39a937069fca7408c7f540c551.zip gcc-a7bf6c088934ef39a937069fca7408c7f540c551.tar.gz gcc-a7bf6c088934ef39a937069fca7408c7f540c551.tar.bz2 |
PR tree-optimization/86114 - ICE in gimple_fold_builtin_strlen with an invalid call to strnlen
gcc/testsuite/ChangeLog:
PR tree-optimization/86114
* gcc.dg/pr86114.c: New test.
gcc/ChangeLog:
PR tree-optimization/86114
* gimple-fold.c (gimple_fold_builtin_strlen): Only handle LHS
of integer types.
* tree-ssa-strlen.c (maybe_set_strlen_range): Same.
From-SVN: r261567
Diffstat (limited to 'gcc/tree-ssa-strlen.c')
-rw-r--r-- | gcc/tree-ssa-strlen.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 8794cc2..a4064a5 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -1124,14 +1124,15 @@ adjust_last_stmt (strinfo *si, gimple *stmt, bool is_strcat) update_stmt (last.stmt); } -/* For an LHS that is an SSA_NAME and for strlen() argument SRC, set - LHS range info to [0, N] if SRC refers to a character array A[N] - with unknown length bounded by N. */ +/* For an LHS that is an SSA_NAME with integer type and for strlen() + argument SRC, set LHS range info to [0, N] if SRC refers to + a character array A[N] with unknown length bounded by N. */ static void maybe_set_strlen_range (tree lhs, tree src) { - if (TREE_CODE (lhs) != SSA_NAME) + if (TREE_CODE (lhs) != SSA_NAME + || !INTEGRAL_TYPE_P (TREE_TYPE (lhs))) return; if (TREE_CODE (src) == SSA_NAME) |