Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent

From: Steven Rostedt
Date: Wed Oct 19 2016 - 15:22:03 EST


On Wed, 19 Oct 2016 15:05:48 -0300
Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:


> Some are the compiler not grokking logic where the compiler gets
> confused with logic that tests one variable to use another and thinks it
> is using garbage (uninitialized stuff), I tried to follow the logic and
> I think it got slightly more confused than me, as I _think_ its not a
> problem, but the one on the case entry for
>
> OLD_RINGBUF_TYPE_TIME_EXTEND
>
> in old_update_pointers() looks like a bug, unless some macro magic is
> taking place that updates that 'lenght' variable.
>
> Rostedt, that -O2 unleashed some warnings, please check, I'll defer
> applying those patches till it doesn't show these warnings, i.e. till
> other patches fixing these issues or simply silencing the compiler with
> a harmless init gets submitted,
>
> Thanks,

Note, that code is for the first version of the ftrace ring buffer that
got changed around 2.6.32 I believe. And since trace-cmd was the only
tool that directly looked at the code, I was able to "break" abi and
update trace-cmd to have a new version. So that code isn't even used
anywhere on newer kernels.

That said, could you add in the case statement for
OLD_RINGBUF_TYPE_TIME_EXTEND:

length = 0;

I think that should be fine.

-- Steve