linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@linaro.org>
To: Leo Yan <leo.yan@arm.com>, Ian Rogers <irogers@google.com>,
	Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"Liang, Kan" <kan.liang@linux.intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf build: Restore {0} initializer since GCC-15
Date: Thu, 20 Mar 2025 11:36:59 +0000	[thread overview]
Message-ID: <4bd59d1f-bbb6-4712-a60f-b47e3ca6a8a9@linaro.org> (raw)
In-Reply-To: <16b146f7-7568-437d-8ee5-f26bfb0354bd@linaro.org>



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.


      parent reply	other threads:[~2025-03-20 11:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19 11:04 [PATCH] perf build: Restore {0} initializer since GCC-15 Leo Yan
2025-03-19 11:19 ` James Clark
2025-03-19 13:30   ` Leo Yan
2025-03-19 15:26     ` Ian Rogers
2025-03-19 18:28       ` Leo Yan
2025-03-19 21:05         ` Ian Rogers
2025-03-20  1:03           ` Namhyung Kim
2025-03-20 11:36   ` James Clark [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4bd59d1f-bbb6-4712-a60f-b47e3ca6a8a9@linaro.org \
    --to=james.clark@linaro.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).