[Bug other/100463] many errors using GTY and hash_map

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 6 21:23:54 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100463

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
So besides the hash_map GTY support being incomplete it also seems like ggc.h
support is missing something.  The following change to the header lets the
whole patch below compile:

diff --git a/gcc/ggc.h b/gcc/ggc.h
index 65f6cb4d19d..9feeffc0f06 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -347,4 +347,9 @@ gt_pch_nx (unsigned int)
 {
 }

+inline void
+gt_pch_nx (long int)
+{
+}
+
 #endif


So to use a hash_map from HWI to int the following appears necessary.  But if I
need unsigned HWI I have to repeat the whole exercise yet again.

diff --git a/gcc/except.c b/gcc/except.c
index a7902bbd555..a47841cf395 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -149,6 +149,21 @@ static GTY(()) int call_site_base;

 static GTY(()) hash_map<tree_hash, tree> *type_to_runtime_map;

+typedef int_hash <HOST_WIDE_INT, 0, HOST_WIDE_INT_MAX> test_int_hash_t;
+typedef hash_map<test_int_hash_t, int> test_int_hash_map_t;
+static GTY(()) test_int_hash_map_t *test_int_hash_map;
+
+inline void
+gt_ggc_mx (test_int_hash_t *)
+{
+}
+
+inline void
+gt_pch_nx (test_int_hash_t *)
+{
+}
+
+
 static GTY(()) tree setjmp_fn;

 /* Describe the SjLj_Function_Context structure.  */
diff --git a/gcc/ggc.h b/gcc/ggc.h
index 65f6cb4d19d..9feeffc0f06 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -347,4 +347,9 @@ gt_pch_nx (unsigned int)
 {
 }

+inline void
+gt_pch_nx (long int)
+{
+}
+
 #endif
diff --git a/gcc/hash-map.h b/gcc/hash-map.h
index 0779c930f0a..c07bd04704f 100644
--- a/gcc/hash-map.h
+++ b/gcc/hash-map.h
@@ -114,6 +114,11 @@ class GTY((user)) hash_map

     static void
       pch_nx_helper (unsigned int, gt_pointer_operator, void *)
+       {
+       }
+
+    static void
+      pch_nx_helper (long int, gt_pointer_operator, void *)
        {
        }


More information about the Gcc-bugs mailing list