Re: [PATCH] Fix perf stat repeat segfault

From: Ravi Bangoria
Date: Thu Jul 11 2019 - 00:44:16 EST


Hi Numfor,

On 7/11/19 2:15 AM, Numfor Mbiziwo-Tiapo wrote:
> -static bool perf_evsel__should_store_id(struct perf_evsel *counter)
> +static bool perf_evsel__should_store_id(struct perf_evsel *counter, int run_idx)
> {
> - return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID;
> + return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID
> + && run_idx < 1;
> }

Build fails for me:

builtin-stat.c: In function âperf_evsel__should_store_idâ:
builtin-stat.c:395:3: error: suggest parentheses around â&&â within â||â [-Werror=parentheses]
return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&& run_idx < 1;
^~~~~~~~~~~~~~
cc1: all warnings being treated as errors

And probably,
Fixes: 82bf311e15d2 ("perf stat: Use group read for event groups")