Disable htable sanitization in pt.c (PR c++/87847).

Message ID 0c85e2f3-5e17-3d59-6abe-7e7efa9f455e@suse.cz
State New
Headers show
Series
  • Disable htable sanitization in pt.c (PR c++/87847).
Related show

Commit Message

Martin Liška June 10, 2019, 12:55 p.m.
Hi.

The patch is about disablement of hash_table sanitization in pt.c.
It's a workaround and I hope Jason can look deeper at the issue.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2019-06-10  Martin Liska  <mliska@suse.cz>

	PR c++/87847
	* hash-table.h: Extend create_gcc, add one parameter
	that is passed into hash_table::hash_table.

gcc/cp/ChangeLog:

2019-06-10  Martin Liska  <mliska@suse.cz>

	PR c++/87847
	* pt.c (init_template_processing): Disable hash table
	sanitization for decl_specializations and type_specializations.
---
 gcc/cp/pt.c      | 5 +++--
 gcc/hash-table.h | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

Comments

Martin Liška June 11, 2019, 7:56 a.m. | #1
On 6/10/19 2:55 PM, Martin Liška wrote:
> Ready to be installed?


Jakub approved me this on IRC. Installed as r272144.

Martin

Patch

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d2cf3458253..a7c9635187a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -28311,8 +28311,9 @@  declare_integer_pack (void)
 void
 init_template_processing (void)
 {
-  decl_specializations = hash_table<spec_hasher>::create_ggc (37);
-  type_specializations = hash_table<spec_hasher>::create_ggc (37);
+  /* FIXME: enable sanitization (PR87847) */
+  decl_specializations = hash_table<spec_hasher>::create_ggc (37, false);
+  type_specializations = hash_table<spec_hasher>::create_ggc (37, false);
 
   if (cxx_dialect >= cxx11)
     declare_integer_pack ();
diff --git a/gcc/hash-table.h b/gcc/hash-table.h
index 6c1fca3459b..4f5e150a0ac 100644
--- a/gcc/hash-table.h
+++ b/gcc/hash-table.h
@@ -386,10 +386,10 @@  public:
 
   /* Create a hash_table in gc memory.  */
   static hash_table *
-  create_ggc (size_t n CXX_MEM_STAT_INFO)
+  create_ggc (size_t n, bool sanitize_eq_and_hash = true CXX_MEM_STAT_INFO)
   {
     hash_table *table = ggc_alloc<hash_table> ();
-    new (table) hash_table (n, true, true, GATHER_STATISTICS,
+    new (table) hash_table (n, true, sanitize_eq_and_hash, GATHER_STATISTICS,
 			    HASH_TABLE_ORIGIN PASS_MEM_STAT);
     return table;
   }