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 5d115b6257a76e33346e01c165512c8559e36b66..fd72410e1867daf298de36deeeedb65913c0289d 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 2efa18275fd915d14ba010ff7b1edc4927779631..ff3230144b04e5c9eb0b4e4886b3a546ab443ea2 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))
        {