Re: [PATCH v2 1/2] perf bench: Fix initialization of union

From: Namhyung Kim

Date: Thu Feb 19 2026 - 14:00:57 EST


Hello,

On Thu, Feb 19, 2026 at 03:02:56PM +0000, Leo Yan wrote:
> On Thu, Feb 19, 2026 at 10:38:57AM +0000, James Clark wrote:
> >
> >
> > On 19/02/2026 10:36 am, James Clark wrote:
> > >
> > >
> > > On 19/02/2026 12:44 am, Namhyung Kim wrote:
> > > > Recent compilers don't initialize all members (or the largest member) in
> > > > an union.  Instead it seems to set the first member only.  So some perf
> > > > bench output shows invalid numbers like below on my system with GCC 15.
> > >
> > > I couldn't find V1 of this so I wasn't sure if it was discussed already,
> > > but wasn't the plan to fix this with a compiler option:
> > >
> > > https://lore.kernel.org/linux-perf-users/20250319110454.3230687-1-leo.yan@xxxxxxx/
> > >
> > > and
> > >
> > > https://lore.kernel.org/linux-perf-users/20250320105235.3498106-1-leo.yan@xxxxxxx/
> >
> > Oh I see V1 was only the second patch, that's why I couldn't find it.
>
> Thanks for bringing up this, James. The latest patch would be:
>
> https://lore.kernel.org/lkml/20250402173056.829400-1-leo.yan@xxxxxxx/
>
> This patch intends to apply the option across tools, but no response
> from the maintainers. Seems to me, it may be good enought to apply the
> option to perf first.

Thanks for the reminder, yeah it looks better.

Thanks,
Namhyung