PR tree-optimization/89644 - false-positive -Warray-bounds on strncpy with unterminat...
authorMartin Sebor <msebor@redhat.com>
Tue, 19 Mar 2019 18:35:42 +0000 (18:35 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Tue, 19 Mar 2019 18:35:42 +0000 (12:35 -0600)
gcc/ChangeLog:
* tree-ssa-strlen.c (handle_builtin_stxncpy): Use full_string_p
rather than endptr as an indicator of nul-termination.

From-SVN: r269809

gcc/ChangeLog
gcc/tree-ssa-strlen.c

index fe1f0640e7f8b041220569e14baffbf90a66502f..991f019bae4bd0b55f1f17a47100a5e7f99218eb 100644 (file)
@@ -1,5 +1,9 @@
 2019-03-19  Martin Sebor  <msebor@redhat.com>
 
+       PR tree-optimization/89644
+       * tree-ssa-strlen.c (handle_builtin_stxncpy): Use full_string_p
+       rather than endptr as an indicator of nul-termination.
+
        PR tree-optimization/89644
        * tree-ssa-strlen.c (handle_builtin_stxncpy): Consider unterminated
        arrays in determining sequence sizes in strncpy and stpncpy.
index cf0f70d9d7f5035e239d730ee78fa6ba64b8d474..a2dc9c7b1026954bceb0ba8cb3c37ad8987a2f94 100644 (file)
@@ -2210,7 +2210,7 @@ handle_builtin_stxncpy (built_in_function, gimple_stmt_iterator *gsi)
         if it is known to be nul-terminated.  */
       if (sidst->nonzero_chars)
        {
-         if (sidst->endptr)
+         if (sidst->full_string_p)
            {
              /* String is known to be nul-terminated.  */
              tree type = TREE_TYPE (sidst->nonzero_chars);
@@ -2236,7 +2236,7 @@ handle_builtin_stxncpy (built_in_function, gimple_stmt_iterator *gsi)
         nul if its known to be nul-terminated.  */
       if (sisrc->nonzero_chars)
        {
-         if (sisrc->endptr)
+         if (sisrc->full_string_p)
            {
              tree type = TREE_TYPE (sisrc->nonzero_chars);
              srcsize = fold_build2 (PLUS_EXPR, type, sisrc->nonzero_chars,