public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/100463] New: many errors using GTY and hash_map
@ 2021-05-06 21:01 msebor at gcc dot gnu.org
  2021-05-06 21:01 ` [Bug other/100463] " msebor at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-06 21:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100463
           Summary: many errors using GTY and hash_map
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

Trying to use a simple hash_map specialization with GTY is a horrible
experience in debugging obscure template errors.  For example, in the trivial
patch below I'd like to define a hash_map from int to int in a file that
already uses a GTY hash_map.  It seems that it should be straightforward but:

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

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

+typedef int_hash <int, 0, 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;
+
 static GTY(()) tree setjmp_fn;

 /* Describe the SjLj_Function_Context structure.  */


...the patch leads to the following errors:

In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h: In function ‘void gt_ggc_mx(int_hash<int, 0, 2147483647>&)’:
./gt-except.h:62:21: error: no matching function for call to
‘gt_ggc_mx(int_hash<int, 0, 2147483647>*)’
   gt_ggc_mx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:454,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/wide-int.h:3329:1: note: candidate: ‘template<class T>
void gt_ggc_mx(generic_wide_int<storage>*)’
 gt_ggc_mx (generic_wide_int <T> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/wide-int.h:3329:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:62:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived from
‘generic_wide_int<storage>’
   gt_ggc_mx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:454,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/wide-int.h:3347:1: note: candidate: ‘template<int N>
void gt_ggc_mx(trailing_wide_ints<N>*)’
 gt_ggc_mx (trailing_wide_ints <N> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/wide-int.h:3347:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:62:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived from
‘trailing_wide_ints<N>’
   gt_ggc_mx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:469,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/poly-int.h:2708:1: note: candidate: ‘template<unsigned
int N, class C> void gt_ggc_mx(poly_int_pod<N, C>*)’
 gt_ggc_mx (poly_int_pod<N, C> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/poly-int.h:2708:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:62:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived from
‘poly_int_pod<N, C>’
   gt_ggc_mx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:472,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/machmode.h:1190:1: note: candidate: ‘template<class T>
void gt_ggc_mx(pod_mode<T>*)’
 gt_ggc_mx (pod_mode<T> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/machmode.h:1190:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:62:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived from
‘pod_mode<T>’
   gt_ggc_mx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:247,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/ggc.h:325:1: note: candidate: ‘void gt_ggc_mx(const
char*)’
 gt_ggc_mx (const char *s)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/ggc.h:325:1: note:   no known conversion for argument 1
from ‘int_hash<int, 0, 2147483647>*’ to ‘const char*’
/ssd/src/gcc/trunk/gcc/ggc.h:336:1: note: candidate: ‘void gt_ggc_mx(int)’
<near match>
 gt_ggc_mx (int)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/ggc.h:336:1: note:   conversion of argument 1 would be
ill-formed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:62:14: error: invalid conversion from ‘int_hash<int, 0,
2147483647>*’ to ‘int’ [-fpermissive]
   gt_ggc_mx (&((*x)));
              ^~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:248,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/vec.h:1349:1: note: candidate: ‘template<class T> void
gt_ggc_mx(vec<T, va_gc>*)’
 gt_ggc_mx (vec<T, va_gc> *v)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/vec.h:1349:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:62:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived from
‘vec<T, va_gc>’
   gt_ggc_mx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:248,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/vec.h:1358:1: note: candidate: ‘template<class T> void
gt_ggc_mx(vec<T, va_gc_atomic, vl_embed>*)’
 gt_ggc_mx (vec<T, va_gc_atomic, vl_embed> *v ATTRIBUTE_UNUSED)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/vec.h:1358:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:62:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived from
‘vec<T, va_gc_atomic, vl_embed>’
   gt_ggc_mx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:305:1: note: candidate: ‘template<class K,
class V, class H> void gt_ggc_mx(hash_map<K, V, H>*)’
 gt_ggc_mx (hash_map<K, V, H> *h)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/hash-map.h:305:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:62:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived from
‘hash_map<K, V, H>’
   gt_ggc_mx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-table.h:1148:1: note: candidate: ‘template<class E>
void gt_ggc_mx(hash_table<E>*)’
 gt_ggc_mx (hash_table<E> *h)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/hash-table.h:1148:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:62:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived from
‘hash_table<E>’
   gt_ggc_mx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:481,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-set.h:193:1: note: candidate: ‘template<class K,
class H> void gt_ggc_mx(hash_set<K, false, H>*)’
 gt_ggc_mx (hash_set<K, false, H> *h)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/hash-set.h:193:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:62:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived from
‘hash_set<K, false, H>’
   gt_ggc_mx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/except.c:117:
/ssd/src/gcc/trunk/gcc/rtl.h:4583:13: note: candidate: ‘void
gt_ggc_mx(rtx_def*&)’
 extern void gt_ggc_mx (rtx &);
             ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/rtl.h:4583:13: note:   no known conversion for argument
1 from ‘int_hash<int, 0, 2147483647>*’ to ‘rtx_def*&’
In file included from /ssd/src/gcc/trunk/gcc/except.c:118:
/ssd/src/gcc/trunk/gcc/tree.h:6282:13: note: candidate: ‘void
gt_ggc_mx(tree_node*&)’
 extern void gt_ggc_mx (tree &);
             ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/tree.h:6282:13: note:   no known conversion for argument
1 from ‘int_hash<int, 0, 2147483647>*’ to ‘tree_node*&’
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:43:1: note: candidate: ‘void gt_ggc_mx(tree_hash&)’
 gt_ggc_mx (struct tree_hash& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
./gt-except.h:43:1: note:   no known conversion for argument 1 from
‘int_hash<int, 0, 2147483647>*’ to ‘tree_hash&’
./gt-except.h:59:1: note: candidate: ‘void gt_ggc_mx(int_hash<int, 0,
2147483647>&)’
 gt_ggc_mx (int_hash<int,0,INT_MAX>& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
./gt-except.h:59:1: note:   no known conversion for argument 1 from
‘int_hash<int, 0, 2147483647>*’ to ‘int_hash<int, 0, 2147483647>&’
./gt-except.h: In function ‘void gt_pch_nx(int_hash<int, 0, 2147483647>&)’:
./gt-except.h:105:21: error: no matching function for call to
‘gt_pch_nx(int_hash<int, 0, 2147483647>*)’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:454,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/wide-int.h:3335:1: note: candidate: ‘template<class T>
void gt_pch_nx(generic_wide_int<storage>*)’
 gt_pch_nx (generic_wide_int <T> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/wide-int.h:3335:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘generic_wide_int<storage>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:454,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/wide-int.h:3341:1: note: candidate: ‘template<class T>
void gt_pch_nx(generic_wide_int<storage>*, void (*)(void*, void*), void*)’
 gt_pch_nx (generic_wide_int <T> *, void (*) (void *, void *), void *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/wide-int.h:3341:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘generic_wide_int<storage>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:454,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/wide-int.h:3353:1: note: candidate: ‘template<int N>
void gt_pch_nx(trailing_wide_ints<N>*)’
 gt_pch_nx (trailing_wide_ints <N> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/wide-int.h:3353:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘trailing_wide_ints<N>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:454,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/wide-int.h:3359:1: note: candidate: ‘template<int N>
void gt_pch_nx(trailing_wide_ints<N>*, void (*)(void*, void*), void*)’
 gt_pch_nx (trailing_wide_ints <N> *, void (*) (void *, void *), void *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/wide-int.h:3359:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘trailing_wide_ints<N>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:469,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/poly-int.h:2714:1: note: candidate: ‘template<unsigned
int N, class C> void gt_pch_nx(poly_int_pod<N, C>*)’
 gt_pch_nx (poly_int_pod<N, C> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/poly-int.h:2714:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘poly_int_pod<N, C>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:469,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/poly-int.h:2720:1: note: candidate: ‘template<unsigned
int N, class C> void gt_pch_nx(poly_int_pod<N, C>*, void (*)(void*, void*),
void*)’
 gt_pch_nx (poly_int_pod<N, C> *, void (*) (void *, void *), void *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/poly-int.h:2720:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘poly_int_pod<N, C>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:472,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/machmode.h:1196:1: note: candidate: ‘template<class T>
void gt_pch_nx(pod_mode<T>*)’
 gt_pch_nx (pod_mode<T> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/machmode.h:1196:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘pod_mode<T>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:472,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/machmode.h:1202:1: note: candidate: ‘template<class T>
void gt_pch_nx(pod_mode<T>*, void (*)(void*, void*), void*)’
 gt_pch_nx (pod_mode<T> *, void (*) (void *, void *), void *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/machmode.h:1202:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘pod_mode<T>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:247,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/ggc.h:331:1: note: candidate: ‘void gt_pch_nx(const
char*)’
 gt_pch_nx (const char *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/ggc.h:331:1: note:   no known conversion for argument 1
from ‘int_hash<int, 0, 2147483647>*’ to ‘const char*’
/ssd/src/gcc/trunk/gcc/ggc.h:341:1: note: candidate: ‘void gt_pch_nx(int)’
<near match>
 gt_pch_nx (int)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/ggc.h:341:1: note:   conversion of argument 1 would be
ill-formed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:14: error: invalid conversion from ‘int_hash<int, 0,
2147483647>*’ to ‘int’ [-fpermissive]
   gt_pch_nx (&((*x)));
              ^~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:247,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/ggc.h:346:1: note: candidate: ‘void gt_pch_nx(unsigned
int)’ <near match>
 gt_pch_nx (unsigned int)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/ggc.h:346:1: note:   conversion of argument 1 would be
ill-formed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:14: error: invalid conversion from ‘int_hash<int, 0,
2147483647>*’ to ‘unsigned int’ [-fpermissive]
   gt_pch_nx (&((*x)));
              ^~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:248,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/vec.h:1369:1: note: candidate: ‘template<class T, class
A> void gt_pch_nx(vec<T, A, vl_embed>*)’
 gt_pch_nx (vec<T, A, vl_embed> *v)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/vec.h:1369:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘vec<T, A, vl_embed>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:248,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/vec.h:1378:1: note: candidate: ‘template<class T, class
A> void gt_pch_nx(vec<T*, A, vl_embed>*, gt_pointer_operator, void*)’
 gt_pch_nx (vec<T *, A, vl_embed> *v, gt_pointer_operator op, void *cookie)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/vec.h:1378:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘vec<T*, A, vl_embed>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:248,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/vec.h:1386:1: note: candidate: ‘template<class T, class
A> void gt_pch_nx(vec<T, A, vl_embed>*, gt_pointer_operator, void*)’
 gt_pch_nx (vec<T, A, vl_embed> *v, gt_pointer_operator op, void *cookie)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/vec.h:1386:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘vec<T, A, vl_embed>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:312:1: note: candidate: ‘template<class K,
class V, class H> void gt_pch_nx(hash_map<K, V, H>*)’
 gt_pch_nx (hash_map<K, V, H> *h)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/hash-map.h:312:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘hash_map<K, V, H>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:327:1: note: candidate: ‘template<class K,
class V, class H> void gt_pch_nx(hash_map<K, V, H>*, gt_pointer_operator,
void*)’
 gt_pch_nx (hash_map<K, V, H> *h, gt_pointer_operator op, void *cookie)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/hash-map.h:327:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘hash_map<K, V, H>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-table.h:1187:1: note: candidate: ‘template<class D>
void gt_pch_nx(hash_table<E>*)’
 gt_pch_nx (hash_table<D> *h)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/hash-table.h:1187:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘hash_table<E>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-table.h:1204:1: note: candidate: ‘template<class D>
void gt_pch_nx(hash_table<E>*, gt_pointer_operator, void*)’
 gt_pch_nx (hash_table<D> *h, gt_pointer_operator op, void *cookie)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/hash-table.h:1204:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘hash_table<E>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:481,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-set.h:200:1: note: candidate: ‘template<class K,
class H> void gt_pch_nx(hash_set<K, false, H>*)’
 gt_pch_nx (hash_set<K, false, H> *h)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/hash-set.h:200:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘hash_set<K, false, H>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:481,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-set.h:207:1: note: candidate: ‘template<class K,
class H> void gt_pch_nx(hash_set<K, false, H>*, gt_pointer_operator, void*)’
 gt_pch_nx (hash_set<K, false, H> *h, gt_pointer_operator op, void *cookie)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/hash-set.h:207:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:105:21: note:   ‘int_hash<int, 0, 2147483647>’ is not derived
from ‘hash_set<K, false, H>’
   gt_pch_nx (&((*x)));
                     ^
In file included from /ssd/src/gcc/trunk/gcc/except.c:117:
/ssd/src/gcc/trunk/gcc/rtl.h:4584:13: note: candidate: ‘void
gt_pch_nx(rtx_def*&)’
 extern void gt_pch_nx (rtx &);
             ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/rtl.h:4584:13: note:   no known conversion for argument
1 from ‘int_hash<int, 0, 2147483647>*’ to ‘rtx_def*&’
/ssd/src/gcc/trunk/gcc/rtl.h:4585:13: note: candidate: ‘void
gt_pch_nx(rtx_def*&, gt_pointer_operator, void*)’
 extern void gt_pch_nx (rtx &, gt_pointer_operator, void *);
             ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/rtl.h:4585:13: note:   candidate expects 3 arguments, 1
provided
In file included from /ssd/src/gcc/trunk/gcc/except.c:118:
/ssd/src/gcc/trunk/gcc/tree.h:6283:13: note: candidate: ‘void
gt_pch_nx(tree_node*&)’
 extern void gt_pch_nx (tree &);
             ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/tree.h:6283:13: note:   no known conversion for argument
1 from ‘int_hash<int, 0, 2147483647>*’ to ‘tree_node*&’
/ssd/src/gcc/trunk/gcc/tree.h:6284:13: note: candidate: ‘void
gt_pch_nx(tree_node*&, gt_pointer_operator, void*)’
 extern void gt_pch_nx (tree &, gt_pointer_operator, void *);
             ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/tree.h:6284:13: note:   candidate expects 3 arguments, 1
provided
In file included from /ssd/src/gcc/trunk/gcc/except.c:3525:
./gt-except.h:86:1: note: candidate: ‘void gt_pch_nx(tree_hash&)’
 gt_pch_nx (struct tree_hash& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
./gt-except.h:86:1: note:   no known conversion for argument 1 from
‘int_hash<int, 0, 2147483647>*’ to ‘tree_hash&’
./gt-except.h:102:1: note: candidate: ‘void gt_pch_nx(int_hash<int, 0,
2147483647>&)’
 gt_pch_nx (int_hash<int,0,INT_MAX>& x_r ATTRIBUTE_UNUSED)
 ^~~~~~~~~
./gt-except.h:102:1: note:   no known conversion for argument 1 from
‘int_hash<int, 0, 2147483647>*’ to ‘int_hash<int, 0, 2147483647>&’
make[2]: *** [Makefile:1142: except.o] Error 1
make[2]: Leaving directory '/ssd/build/gcc-trunk/gcc'
make[1]: *** [Makefile:4781: all-stage1-gcc] Error 2
make[1]: Leaving directory '/ssd/build/gcc-trunk'
make: *** [Makefile:27587: stage1-bubble] Error 2
make: Leaving directory '/ssd/build/gcc-trunk'
Command exited with non-zero status 2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/100463] many errors using GTY and hash_map
  2021-05-06 21:01 [Bug other/100463] New: many errors using GTY and hash_map msebor at gcc dot gnu.org
@ 2021-05-06 21:01 ` msebor at gcc dot gnu.org
  2021-05-06 21:02 ` msebor at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-06 21:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Adding the two missing function like below fixes the errors.

diff --git a/gcc/except.c b/gcc/except.c
index a7902bbd555..913632f5199 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 <int, 0, 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.  */

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/100463] many errors using GTY and hash_map
  2021-05-06 21:01 [Bug other/100463] New: many errors using GTY and hash_map msebor at gcc dot gnu.org
  2021-05-06 21:01 ` [Bug other/100463] " msebor at gcc dot gnu.org
@ 2021-05-06 21:02 ` msebor at gcc dot gnu.org
  2021-05-06 21:19 ` msebor at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-06 21:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
But suppose I change my mind and want to define a map from HWI_INT to int:

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.  */


I now get another series of errors:

In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h: In instantiation of ‘static void hash_map<
<template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>
>::hash_entry::pch_nx(hash_map< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3> >::hash_entry&) [with KeyId
= int_hash<long int, 0, 9223372036854775807>; Value = int; Traits =
simple_hashmap_traits<default_hash_traits<int_hash<long int, 0,
9223372036854775807> >, int>]’:
/ssd/src/gcc/trunk/gcc/hash-table.h:1198:17:   required from ‘void
gt_pch_nx(hash_table<E>*) [with D = hash_map<int_hash<long int, 0,
9223372036854775807>, int>::hash_entry]’
/ssd/src/gcc/trunk/gcc/hash-map.h:314:13:   required from ‘void
gt_pch_nx(hash_map<K, V, H>*) [with K = int_hash<long int, 0,
9223372036854775807>; V = int; H =
simple_hashmap_traits<default_hash_traits<int_hash<long int, 0,
9223372036854775807> >, int>]’
./gt-except.h:97:19:   required from here
/ssd/src/gcc/trunk/gcc/hash-map.h:87:12: error: call of overloaded
‘gt_pch_nx(hash_map<int_hash<long int, 0, 9223372036854775807>, int>::Key&)’ is
ambiguous
  gt_pch_nx (e.m_key);
  ~~~~~~~~~~^~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:247,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/ggc.h:341:1: note: candidate: ‘void gt_pch_nx(int)’
 gt_pch_nx (int)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/ggc.h:346:1: note: candidate: ‘void gt_pch_nx(unsigned
int)’
 gt_pch_nx (unsigned int)
 ^~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h: In instantiation of ‘static void hash_map<
<template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>
>::hash_entry::pch_nx_helper(T&, gt_pointer_operator, void*) [with T = long
int; KeyId = int_hash<long int, 0, 9223372036854775807>; Value = int; Traits =
simple_hashmap_traits<default_hash_traits<int_hash<long int, 0,
9223372036854775807> >, int>; gt_pointer_operator = void (*)(void*, void*)]’:
/ssd/src/gcc/trunk/gcc/hash-map.h:93:16:   required from ‘static void hash_map<
<template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>
>::hash_entry::pch_nx(hash_map< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3> >::hash_entry&,
gt_pointer_operator, void*) [with KeyId = int_hash<long int, 0,
9223372036854775807>; Value = int; Traits =
simple_hashmap_traits<default_hash_traits<int_hash<long int, 0,
9223372036854775807> >, int>; gt_pointer_operator = void (*)(void*, void*)]’
/ssd/src/gcc/trunk/gcc/hash-table.h:1181:17:   required from ‘void
hashtab_entry_note_pointers(void*, void*, gt_pointer_operator, void*) [with D =
hash_map<int_hash<long int, 0, 9223372036854775807>, int>::hash_entry;
gt_pointer_operator = void (*)(void*, void*)]’
/ssd/src/gcc/trunk/gcc/hash-table.h:1190:26:   required from ‘void
gt_pch_nx(hash_table<E>*) [with D = hash_map<int_hash<long int, 0,
9223372036854775807>, int>::hash_entry]’
/ssd/src/gcc/trunk/gcc/hash-map.h:314:13:   required from ‘void
gt_pch_nx(hash_map<K, V, H>*) [with K = int_hash<long int, 0,
9223372036854775807>; V = int; H =
simple_hashmap_traits<default_hash_traits<int_hash<long int, 0,
9223372036854775807> >, int>]’
./gt-except.h:97:19:   required from here
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: error: no matching function for call
to ‘gt_pch_nx(long int*, void (*&)(void*, void*), void*&)’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:454,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/wide-int.h:3335:1: note: candidate: ‘template<class T>
void gt_pch_nx(generic_wide_int<storage>*)’
 gt_pch_nx (generic_wide_int <T> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/wide-int.h:3335:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types
‘generic_wide_int<storage>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:454,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/wide-int.h:3341:1: note: candidate: ‘template<class T>
void gt_pch_nx(generic_wide_int<storage>*, void (*)(void*, void*), void*)’
 gt_pch_nx (generic_wide_int <T> *, void (*) (void *, void *), void *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/wide-int.h:3341:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types
‘generic_wide_int<storage>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:454,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/wide-int.h:3353:1: note: candidate: ‘template<int N>
void gt_pch_nx(trailing_wide_ints<N>*)’
 gt_pch_nx (trailing_wide_ints <N> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/wide-int.h:3353:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types
‘trailing_wide_ints<N>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:454,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/wide-int.h:3359:1: note: candidate: ‘template<int N>
void gt_pch_nx(trailing_wide_ints<N>*, void (*)(void*, void*), void*)’
 gt_pch_nx (trailing_wide_ints <N> *, void (*) (void *, void *), void *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/wide-int.h:3359:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types
‘trailing_wide_ints<N>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:469,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/poly-int.h:2714:1: note: candidate: ‘template<unsigned
int N, class C> void gt_pch_nx(poly_int_pod<N, C>*)’
 gt_pch_nx (poly_int_pod<N, C> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/poly-int.h:2714:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types
‘poly_int_pod<N, C>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:469,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/poly-int.h:2720:1: note: candidate: ‘template<unsigned
int N, class C> void gt_pch_nx(poly_int_pod<N, C>*, void (*)(void*, void*),
void*)’
 gt_pch_nx (poly_int_pod<N, C> *, void (*) (void *, void *), void *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/poly-int.h:2720:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types
‘poly_int_pod<N, C>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:472,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/machmode.h:1196:1: note: candidate: ‘template<class T>
void gt_pch_nx(pod_mode<T>*)’
 gt_pch_nx (pod_mode<T> *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/machmode.h:1196:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types
‘pod_mode<T>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/coretypes.h:472,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/machmode.h:1202:1: note: candidate: ‘template<class T>
void gt_pch_nx(pod_mode<T>*, void (*)(void*, void*), void*)’
 gt_pch_nx (pod_mode<T> *, void (*) (void *, void *), void *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/machmode.h:1202:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types
‘pod_mode<T>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:247,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/ggc.h:331:1: note: candidate: ‘void gt_pch_nx(const
char*)’
 gt_pch_nx (const char *)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/ggc.h:331:1: note:   candidate expects 1 argument, 3
provided
/ssd/src/gcc/trunk/gcc/ggc.h:341:1: note: candidate: ‘void gt_pch_nx(int)’
 gt_pch_nx (int)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/ggc.h:341:1: note:   candidate expects 1 argument, 3
provided
/ssd/src/gcc/trunk/gcc/ggc.h:346:1: note: candidate: ‘void gt_pch_nx(unsigned
int)’
 gt_pch_nx (unsigned int)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/ggc.h:346:1: note:   candidate expects 1 argument, 3
provided
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:248,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/vec.h:1369:1: note: candidate: ‘template<class T, class
A> void gt_pch_nx(vec<T, A, vl_embed>*)’
 gt_pch_nx (vec<T, A, vl_embed> *v)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/vec.h:1369:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types ‘vec<T, A,
vl_embed>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:248,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/vec.h:1378:1: note: candidate: ‘template<class T, class
A> void gt_pch_nx(vec<T*, A, vl_embed>*, gt_pointer_operator, void*)’
 gt_pch_nx (vec<T *, A, vl_embed> *v, gt_pointer_operator op, void *cookie)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/vec.h:1378:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types ‘vec<T*, A,
vl_embed>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:248,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/vec.h:1386:1: note: candidate: ‘template<class T, class
A> void gt_pch_nx(vec<T, A, vl_embed>*, gt_pointer_operator, void*)’
 gt_pch_nx (vec<T, A, vl_embed> *v, gt_pointer_operator op, void *cookie)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/vec.h:1386:1: note:   template argument
deduction/substitution failed:
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h:107:14: note:   mismatched types ‘vec<T, A,
vl_embed>’ and ‘long int’
    gt_pch_nx (&x, op, cookie);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~
make[2]: *** [Makefile:1142: except.o] Error 1
make[2]: Leaving directory '/ssd/build/gcc-trunk/gcc'
make[1]: *** [Makefile:4781: all-stage1-gcc] Error 2
make[1]: Leaving directory '/ssd/build/gcc-trunk'
make: *** [Makefile:27587: stage1-bubble] Error 2
make: Leaving directory '/ssd/build/gcc-trunk'
Command exited with non-zero status 2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/100463] many errors using GTY and hash_map
  2021-05-06 21:01 [Bug other/100463] New: many errors using GTY and hash_map msebor at gcc dot gnu.org
  2021-05-06 21:01 ` [Bug other/100463] " msebor at gcc dot gnu.org
  2021-05-06 21:02 ` msebor at gcc dot gnu.org
@ 2021-05-06 21:19 ` msebor at gcc dot gnu.org
  2021-05-06 21:23 ` msebor at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-06 21:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
As it turns out, the hash_map primary template is incomplete.  Defining the
following member fixes that error only to expose another:

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 *)
        {
        }

In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:595,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/hash-map.h: In instantiation of ‘static void hash_map<
<template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>
>::hash_entry::pch_nx(hash_map< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3> >::hash_entry&) [with KeyId
= int_hash<long int, 0, 9223372036854775807>; Value = int; Traits =
simple_hashmap_traits<default_hash_traits<int_hash<long int, 0,
9223372036854775807> >, int>]’:
/ssd/src/gcc/trunk/gcc/hash-table.h:1198:17:   required from ‘void
gt_pch_nx(hash_table<E>*) [with D = hash_map<int_hash<long int, 0,
9223372036854775807>, int>::hash_entry]’
/ssd/src/gcc/trunk/gcc/hash-map.h:319:13:   required from ‘void
gt_pch_nx(hash_map<K, V, H>*) [with K = int_hash<long int, 0,
9223372036854775807>; V = int; H =
simple_hashmap_traits<default_hash_traits<int_hash<long int, 0,
9223372036854775807> >, int>]’
./gt-except.h:97:19:   required from here
/ssd/src/gcc/trunk/gcc/hash-map.h:87:12: error: call of overloaded
‘gt_pch_nx(hash_map<int_hash<long int, 0, 9223372036854775807>, int>::Key&)’ is
ambiguous
  gt_pch_nx (e.m_key);
  ~~~~~~~~~~^~~~~~~~~
In file included from /ssd/src/gcc/trunk/gcc/hash-table.h:247,
                 from /ssd/src/gcc/trunk/gcc/coretypes.h:480,
                 from /ssd/src/gcc/trunk/gcc/except.c:114:
/ssd/src/gcc/trunk/gcc/ggc.h:341:1: note: candidate: ‘void gt_pch_nx(int)’
 gt_pch_nx (int)
 ^~~~~~~~~
/ssd/src/gcc/trunk/gcc/ggc.h:346:1: note: candidate: ‘void gt_pch_nx(unsigned
int)’
 gt_pch_nx (unsigned int)
 ^~~~~~~~~

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/100463] many errors using GTY and hash_map
  2021-05-06 21:01 [Bug other/100463] New: many errors using GTY and hash_map msebor at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-05-06 21:19 ` msebor at gcc dot gnu.org
@ 2021-05-06 21:23 ` msebor at gcc dot gnu.org
  2021-05-06 21:35 ` msebor at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-06 21:23 UTC (permalink / raw)
  To: gcc-bugs

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 *)
        {
        }

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/100463] many errors using GTY and hash_map
  2021-05-06 21:01 [Bug other/100463] New: many errors using GTY and hash_map msebor at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-05-06 21:23 ` msebor at gcc dot gnu.org
@ 2021-05-06 21:35 ` msebor at gcc dot gnu.org
  2021-05-07  7:18 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-06 21:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
Created attachment 50770
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50770&action=edit
Patch to complete GTY support for hash_map.

Patch to add support for GTY hash_map for all integer types.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/100463] many errors using GTY and hash_map
  2021-05-06 21:01 [Bug other/100463] New: many errors using GTY and hash_map msebor at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-05-06 21:35 ` msebor at gcc dot gnu.org
@ 2021-05-07  7:18 ` rguenth at gcc dot gnu.org
  2021-05-21  1:50 ` msebor at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-07  7:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Why would you want to have a hash_map<int,int> GTY(())ed at all?  For PCH?!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/100463] many errors using GTY and hash_map
  2021-05-06 21:01 [Bug other/100463] New: many errors using GTY and hash_map msebor at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-05-07  7:18 ` rguenth at gcc dot gnu.org
@ 2021-05-21  1:50 ` msebor at gcc dot gnu.org
  2021-05-27 19:41 ` cvs-commit at gcc dot gnu.org
  2021-05-27 19:42 ` msebor at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-21  1:50 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-05-21
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/100463] many errors using GTY and hash_map
  2021-05-06 21:01 [Bug other/100463] New: many errors using GTY and hash_map msebor at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-05-21  1:50 ` msebor at gcc dot gnu.org
@ 2021-05-27 19:41 ` cvs-commit at gcc dot gnu.org
  2021-05-27 19:42 ` msebor at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-27 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:5d05e83e243931c291409d4771f31747b6c04eb0

commit r12-1096-g5d05e83e243931c291409d4771f31747b6c04eb0
Author: Martin Sebor <msebor@redhat.com>
Date:   Thu May 27 13:37:43 2021 -0600

    PR other/100463 - many errors using GTY and hash_map

    gcc/ChangeLog:
            * ggc.h (gt_ggc_mx): Add overloads for all integers.
            (gt_pch_nx):  Same.
            * hash-map.h (class hash_map): Add pch_nx_helper overloads for all
            integers.
            (hash_map::operator==): New function.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug other/100463] many errors using GTY and hash_map
  2021-05-06 21:01 [Bug other/100463] New: many errors using GTY and hash_map msebor at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-05-27 19:41 ` cvs-commit at gcc dot gnu.org
@ 2021-05-27 19:42 ` msebor at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-27 19:42 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
           Keywords|                            |build
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
      Known to fail|                            |10.3.0, 11.1.0, 9.3.0

--- Comment #8 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed for GCC 12.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-27 19:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 21:01 [Bug other/100463] New: many errors using GTY and hash_map msebor at gcc dot gnu.org
2021-05-06 21:01 ` [Bug other/100463] " msebor at gcc dot gnu.org
2021-05-06 21:02 ` msebor at gcc dot gnu.org
2021-05-06 21:19 ` msebor at gcc dot gnu.org
2021-05-06 21:23 ` msebor at gcc dot gnu.org
2021-05-06 21:35 ` msebor at gcc dot gnu.org
2021-05-07  7:18 ` rguenth at gcc dot gnu.org
2021-05-21  1:50 ` msebor at gcc dot gnu.org
2021-05-27 19:41 ` cvs-commit at gcc dot gnu.org
2021-05-27 19:42 ` msebor at gcc dot gnu.org

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).