[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4bd59d1f-bbb6-4712-a60f-b47e3ca6a8a9@linaro.org>
Date: Thu, 20 Mar 2025 11:36:59 +0000
From: James Clark <james.clark@...aro.org>
To: Leo Yan <leo.yan@....com>, Ian Rogers <irogers@...gle.com>,
Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, 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:19 am, James Clark wrote:
>
>
> 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.
>
After reading in a bit more detail and seeing all the extra
inconsistencies between compilers/versions/syntaxes etc I retract this
and agree that -fzero-init-padding-bits=all would be harmless and only
make things better.
Powered by blists - more mailing lists