diff options
author | Jeff Law <law@gcc.gnu.org> | 2018-09-25 16:17:45 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2018-09-25 16:17:45 -0600 |
commit | c7813484bc9fe2c578d7538d0a9e286bf2e64599 (patch) | |
tree | 9e120ff490c0f193509af127eb4cae401e944f54 /gcc/builtins.c | |
parent | a9f6e019d15819f52b312e1b10cd460b59b57780 (diff) | |
download | gcc-c7813484bc9fe2c578d7538d0a9e286bf2e64599.zip gcc-c7813484bc9fe2c578d7538d0a9e286bf2e64599.tar.gz gcc-c7813484bc9fe2c578d7538d0a9e286bf2e64599.tar.bz2 |
re PR c/87387 (trunk/gcc/builtins.c:585:7: warning: -Wself-assign problem)
PR c/87387
* builtins.c (unterminated_array): Simplify.
* expr.c (string_constant): Handle SSA_NAME. Add more exceptions
where pointer arithmetic is safe.
* gcc.dg/warn-stpcpy-no-nul.c: Drop unnecessary xfails.
* gcc.dg/warn-stplen-no-nul.c: Likewise.
From-SVN: r264585
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 1d4de09..5f00208 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -570,28 +570,9 @@ warn_string_no_nul (location_t loc, const char *fn, tree arg, tree decl) tree unterminated_array (tree exp) { - if (TREE_CODE (exp) == SSA_NAME) - { - gimple *stmt = SSA_NAME_DEF_STMT (exp); - if (!is_gimple_assign (stmt)) - return NULL_TREE; - - tree rhs1 = gimple_assign_rhs1 (stmt); - tree_code code = gimple_assign_rhs_code (stmt); - if (code == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (rhs1, 0)) == ARRAY_REF) - rhs1 = rhs1; - else if (code != POINTER_PLUS_EXPR) - return NULL_TREE; - - exp = rhs1; - } - tree nonstr = NULL; - if (c_strlen (exp, 1, &nonstr, 1) == NULL && nonstr) - return nonstr; - - return NULL_TREE; + c_strlen (exp, 1, &nonstr); + return nonstr; } /* Compute the length of a null-terminated character string or wide |