[PATCH] Enhance syntax of -fdbg-cnt.

Martin Liška mliska@suse.cz
Tue Nov 12 09:01:00 GMT 2019


On 11/12/19 9:35 AM, Richard Biener wrote:
> 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.

Works for me ;)

There's one another version that I'm testing right now.

Martin

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Enhance-syntax-of-fdbg-cnt.patch
Type: text/x-patch
Size: 11293 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191112/04e19500/attachment.bin>


More information about the Gcc-patches mailing list