]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix memory leak in vectorizable_store
authorRichard Biener <rguenther@suse.de>
Thu, 18 Jan 2024 12:04:17 +0000 (13:04 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 18 Jan 2024 13:13:03 +0000 (14:13 +0100)
The following fixes a memory leak in vectorizable_store which happens
because the functions populating gvec_oprnds[i] will call .create ()
on the incoming vector, leaking what we've previously allocated.

* tree-vect-stmts.cc (vectorizable_store): Do not allocate
storage for gvec_oprnds elements.

gcc/tree-vect-stmts.cc

index cabd4e3ae86473c4fdaf1315cdbf434914b68b7b..69d76c3b350f6addd3a3d39797ff541f3aaa97de 100644 (file)
@@ -8772,7 +8772,7 @@ vectorizable_store (vec_info *vinfo,
   tree vec_mask = NULL;
   auto_delete_vec<auto_vec<tree>> gvec_oprnds (group_size);
   for (i = 0; i < group_size; i++)
-    gvec_oprnds.quick_push (new auto_vec<tree> (ncopies));
+    gvec_oprnds.quick_push (new auto_vec<tree> ());
 
   if (memory_access_type == VMAT_LOAD_STORE_LANES)
     {