The build suffers from the static initialization order fiasco:
==30085== Invalid read of size 4
==30085== at 0x1D451CD: hash_table_mod1 (hash-table.h:344)
==30085== by 0x1D451CD: hash_table<hash_map<mem_alloc_description<vec_usage>::mem_location_hash,
vec_usage*,
simple_hashmap_traits<default_hash_traits<mem_alloc_description<vec_usage>::mem_location_hash>,
vec_usage*> >::hash_entry, false, xcallocator>::find_with_hash(mem_location* const&, unsigned int)
(hash-table.h:911)
==30085== by 0x1D411F7: get (hash-map.h:185)
==30085== by 0x1D411F7: register_descriptor (mem-stats.h:417)
==30085== by 0x1D411F7: register_descriptor (mem-stats.h:451)
==30085== by 0x1D411F7: vec_prefix::register_overhead(void*, unsigned long,
unsigned long, char const*, int, char const*) (vec.c:132)
==30085== by 0xA2DB28: reserve<loc_spans::span> (vec.h:294)
==30085== by 0xA2DB28: vec<loc_spans::span, va_heap,
vl_ptr>::reserve(unsigned int, bool, char const*, int, char const*) [clone
.isra.0] (vec.h:1778)
==30085== by 0x9039C7: reserve_exact (vec.h:1798)
==30085== by 0x9039C7: create (vec.h:1813)
==30085== by 0x9039C7: loc_spans (module.cc:3281)
==30085== by 0x9039C7: __static_initialization_and_destruction_0
(module.cc:3340)
==30085== by 0x9039C7: _GLOBAL__sub_I_map_context_from (gt-cp-module.h:360)
==30085== by 0x1E00F6C: __libc_csu_init (elf-init.c:89)
==30085== by 0x4FFF0DD: (below main) (in /lib64/libc-2.32.so)
==30085== Address 0x28 is not stack'd, malloc'd or (recently) free'd
So vec_mem_desc is not initialized before a static member in module.cc.
That can be fixed by usage of GNU C++ extension init_priority.
Ready to be installed?
Thanks,
Martin
gcc/ChangeLog:
* vec.c: Use init_priority for vec_mem_desc.
---
gcc/vec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/vec.c b/gcc/vec.c
index a28899170ed..1671f26c045 100644
--- a/gcc/vec.c
+++ b/gcc/vec.c
@@ -121,7 +121,8 @@ public:
};
/* Vector memory description. */
-static mem_alloc_description <vec_usage> vec_mem_desc;
+static mem_alloc_description <vec_usage> vec_mem_desc
+ __attribute__ ((init_priority (101)));
/* Account the overhead. */
--
2.29.2