Skip to content
Snippets Groups Projects
Commit 11f07ef3 authored by Jakub Jelinek's avatar Jakub Jelinek
Browse files

c++: Fix PCH ICE with __builtin_source_location [PR98343]

Seems the ggc_remove ppc_nx 3 operand member relies on the hash tables to
contain pointers in the first element, which is not the case for
source_location_table* hash table, which has location_t and unsigned as
first two members and pointer somewhere else.
I've tried to change:
   static void
   pch_nx (T &p, gt_pointer_operator op, void *cookie)
   {
-    op (&p, cookie);
+    extern void gt_pch_nx (T *, gt_pointer_operator, void *);
+    gt_pch_nx (&p, op, cookie);
   }
in hash-traits.h, but that failed miserably.
So, this patch instead overrides the two pch_nx overloads (only the second
one is needed, the former one is identical to the ggc_remove one) but I need
to override both.

2020-12-18  Jakub Jelinek  <jakub@redhat.com>

	PR c++/98343
	* cp-gimplify.c (source_location_table_entry_hash::pch_nx): Override
	static member functions from ggc_remove.

	* g++.dg/pch/pr98343.C: New test.
	* g++.dg/pch/pr98343.Hs: New file.
parent dc006893
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment