re PR tree-optimization/82977 (AddressSanitizer: heap-use-after-free in strlen_optimi...
authorJakub Jelinek <jakub@redhat.com>
Wed, 15 Nov 2017 08:40:32 +0000 (09:40 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 15 Nov 2017 08:40:32 +0000 (09:40 +0100)
PR tree-optimization/82977
* tree-ssa-strlen.c (strlen_optimize_stmt): Pass a reference to a copy
constructed temporary to strlen_to_stridx.put.

From-SVN: r254757

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

index 5d115b6..fd72410 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/82977
+       * tree-ssa-strlen.c (strlen_optimize_stmt): Pass a reference to a copy
+       constructed temporary to strlen_to_stridx.put.
+
 2017-11-15  Martin Liska  <mliska@suse.cz>
 
        * configure.ac: Remove -fkeep-inline-functions from coverage_flags.
index 2efa182..ff32301 100644 (file)
@@ -2968,7 +2968,7 @@ strlen_optimize_stmt (gimple_stmt_iterator *gsi)
 
        tree rhs1 = gimple_assign_rhs1 (stmt);
        if (stridx_strlenloc *ps = strlen_to_stridx.get (rhs1))
-         strlen_to_stridx.put (lhs, *ps);
+         strlen_to_stridx.put (lhs, stridx_strlenloc (*ps));
       }
     else if (TREE_CODE (lhs) != SSA_NAME && !TREE_SIDE_EFFECTS (lhs))
        {