lkml.org 
[lkml]   [2020]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH perf/core] perf intel-pt: Fix clang build failure in intel_pt_synth_pebs_sample
Em Wed, May 13, 2020 at 06:47:38PM -0500, Gustavo A. R. Silva escreveu:
> Fix the following build failure generated with command
> $ make CC=clang HOSTCC=clang -C tools/ perf:
>
> util/intel-pt.c:1802:24: error: field 'br_stack' with variable sized type 'struct branch_stack' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
> struct branch_stack br_stack;
> ^
> 1 error generated.
>
> Fix this by reordering the members of struct br.

Yeah, I noticed that as far back as with ubuntu 16.04's clang:

clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)

util/intel-pt.c:1802:24: error: field 'br_stack' with variable sized type 'struct branch_stack' not at the end of a struct or class is a GNU
extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
struct branch_stack br_stack;
^
1 error generated.


Will fold this with the bug introducing the problem to avoid bisection
problems.


> Clang version 11.0.0 was used.
>
> Fixes: f283f293a60d ("perf tools: Replace zero-length array with flexible-array")
> Reported-by: Ian Rogers <irogers@google.com>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
> Here to fix what I break. :)
>
> tools/perf/util/intel-pt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> index f17b1e769ae4..b34179e3926f 100644
> --- a/tools/perf/util/intel-pt.c
> +++ b/tools/perf/util/intel-pt.c
> @@ -1799,8 +1799,8 @@ static int intel_pt_synth_pebs_sample(struct intel_pt_queue *ptq)
>
> if (sample_type & PERF_SAMPLE_BRANCH_STACK) {
> struct {
> - struct branch_stack br_stack;
> struct branch_entry entries[LBRS_MAX];
> + struct branch_stack br_stack;
> } br;
>
> if (items->mask[INTEL_PT_LBR_0_POS] ||
> --
> 2.26.2
>

--

- Arnaldo

\
 
 \ /
  Last update: 2020-05-14 15:10    [W:0.091 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site