This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Enhance syntax of -fdbg-cnt.
On Mon, Nov 11, 2019 at 3:56 PM Martin Liška <mliska@suse.cz> wrote:
>
> On 11/11/19 3:19 PM, Richard Biener wrote:
> > -static unsigned int limit_low[debug_counter_number_of_counters];
> > +static auto_vec<limit_tuple>
> > *limits[debug_counter_number_of_counters] = {NULL};
>
> Hm, apparently it's not working. I see a stack corruption when calling
> dbgcnt. I also explicitly called .create (2) for all vectors, but the
> ICE still happens.
You did use vec<> instead of auto_vec<> , did you? Using auto_vec<>
here IMHO is bogus anyways.
> Anyway, I would probably go with the original patch. It's handy for me
> to also have limits[index] == NULL to indicate a counter that is not set.
But there's vec.exists_p () which just checks whether the m_vec member
is NULL.
Since file-scope statics are zero-initialized by default even
static vec<limit_tuple> limits[debug_counter_number_of_counters];
should work.
> That's a different state from limits[index].is_empty() which means all
> previous intervals were popped and we should return false.
Yes, is_empty() vs. exists_p().
> Martin