Re: [PATCH] Fix --enable-gather-detailed-mem-stats build.

2021-01-04 Thread Richard Biener via Gcc-patches
On Wed, Dec 16, 2020 at 10:52 AM Martin Liška wrote: > > On 12/16/20 10:38 AM, Rainer Orth wrote: > > Hi Jakub, > > > >> On Wed, Dec 16, 2020 at 10:20:09AM +0100, Martin Liška wrote: > >>> So vec_mem_desc is not initialized before a static member in module.cc. > >>> We can fix it by using construc

Re: [PATCH] Fix --enable-gather-detailed-mem-stats build.

2020-12-16 Thread Martin Liška
On 12/16/20 10:38 AM, Rainer Orth wrote: Hi Jakub, On Wed, Dec 16, 2020 at 10:20:09AM +0100, Martin Liška wrote: So vec_mem_desc is not initialized before a static member in module.cc. We can fix it by using constructor attribute. [...] + of all static variables. */ + +static void +__attr

Re: [PATCH] Fix --enable-gather-detailed-mem-stats build.

2020-12-16 Thread Rainer Orth
Hi Jakub, > On Wed, Dec 16, 2020 at 10:20:09AM +0100, Martin Liška wrote: >> So vec_mem_desc is not initialized before a static member in module.cc. >> We can fix it by using constructor attribute. [...] >> + of all static variables. */ >> + >> +static void >> +__attribute__((constructor (101))

Re: [PATCH] Fix --enable-gather-detailed-mem-stats build.

2020-12-16 Thread Martin Liška
On 12/16/20 10:26 AM, Jakub Jelinek wrote: I think this needs to be guarded based on which compiler is used to compile GCC. Do you mean basing that on __GNUC__? Perhaps we could say that we don't support --enable-gather-detailed-mem-stats when the compiler isn't built by GCC (or other compil

Re: [PATCH] Fix --enable-gather-detailed-mem-stats build.

2020-12-16 Thread Jakub Jelinek via Gcc-patches
On Wed, Dec 16, 2020 at 10:20:09AM +0100, Martin Liška wrote: > So vec_mem_desc is not initialized before a static member in module.cc. > We can fix it by using constructor attribute. > > gcc/ChangeLog: > > * vec.c (init_vec_mem_desc): New function. > (vec_prefix::register_overhead):

Re: [PATCH] Fix --enable-gather-detailed-mem-stats build.

2020-12-16 Thread Martin Liška
On 12/16/20 10:08 AM, Iain Sandoe wrote: This will break bootstrap on targets without init_priority (e.g. Darwin) All right, based on the chat on IRC, I suggest using C static constructor with corresponding priority. Ready to be installed? Thanks, Martin >From 4ecf4f8df8d5b6b75cfe7cc5df90176e0

Re: [PATCH] Fix --enable-gather-detailed-mem-stats build.

2020-12-16 Thread Iain Sandoe via Gcc-patches
Martin Liška wrote: 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::mem_location_hash, vec_usage*, simple_hashmap_traits::mem_location_hash