public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Fix sccvn VN_GET_INFO bug (PR middle-end/70239)
@ 2016-03-15 16:16 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2016-03-15 16:16 UTC (permalink / raw)
  To: gcc-patches

Hi!

As mentioned in the PR, the problem is that we might grow the vector
without clearing new entries, while we overwrite the last entry, there might
be gaps containing garbage pointers and cause lots of weird issues.

The testcase is unfortunately too large (creduced it down to 26100 bytes)
for the testsuite.  Bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk as obvious.

2016-03-15  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/70239
	* tree-ssa-sccvn.c (VN_INFO_GET): Use safe_grow_cleared instead
	of safe_grow.

--- gcc/tree-ssa-sccvn.c.jj	2016-02-16 16:14:43.000000000 +0100
+++ gcc/tree-ssa-sccvn.c	2016-03-15 13:02:40.876997092 +0100
@@ -407,7 +407,7 @@ VN_INFO_GET (tree name)
   newinfo = XOBNEW (&vn_ssa_aux_obstack, struct vn_ssa_aux);
   memset (newinfo, 0, sizeof (struct vn_ssa_aux));
   if (SSA_NAME_VERSION (name) >= vn_ssa_aux_table.length ())
-    vn_ssa_aux_table.safe_grow (SSA_NAME_VERSION (name) + 1);
+    vn_ssa_aux_table.safe_grow_cleared (SSA_NAME_VERSION (name) + 1);
   vn_ssa_aux_table[SSA_NAME_VERSION (name)] = newinfo;
   return newinfo;
 }

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-15 16:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-15 16:16 [committed] Fix sccvn VN_GET_INFO bug (PR middle-end/70239) Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).