[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <16b146f7-7568-437d-8ee5-f26bfb0354bd@linaro.org>
Date: Wed, 19 Mar 2025 11:19:38 +0000
From: James Clark <james.clark@...aro.org>
To: Leo Yan <leo.yan@....com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
"Liang, Kan" <kan.liang@...ux.intel.com>, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf build: Restore {0} initializer since GCC-15
On 19/03/2025 11:04 am, Leo Yan wrote:
> GCC-15 release claims [1]:
>
> {0} initializer in C or C++ for unions no longer guarantees clearing
> of the whole union (except for static storage duration initialization),
> it just initializes the first union member to zero. If initialization
> of the whole union including padding bits is desirable, use {} (valid
> in C23 or C++) or use -fzero-init-padding-bits=unions option to
> restore old GCC behavior.
>
> This new behaviour might cause stale and unexpected data we defined in
> Perf. Add the -fzero-init-padding-bits=unions option for entirely
> zeroing union structures.
>
Do we need this? I don't see any unions initialized in that way. In fact
there is only one struct initialized with {0}, the other handful are
char*s but I don't think either are affected.
Adding options that allow people to add more non standard code doesn't
feel very portable or in the spirit of doing it the right way. Maybe
there's an argument that it guards against future mistakes, but it's not
mentioned in the commit message.
Powered by blists - more mailing lists