This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Annoying silly warning emitted by gcc?
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Warren D Smith <warren dot wds at gmail dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Thu, 24 Jan 2019 01:25:19 +0000
- Subject: Re: Annoying silly warning emitted by gcc?
- References: <CAAJP7Y1Dc0DWBO7UsTcYxjsofx9a8zQOtKFc=UhvY2Ck5h3GmA@mail.gmail.com>
On Wed, 23 Jan 2019, Warren D Smith wrote:
> x = x^x;
>
> The purpose of the above is to load "x" with zero.
> For very wide types, say 256 bits wide, explicitly loading 0
> is deprecated by Intel since taking too much memory.
> XORing x with itself always yields 0 and is allegedly
> a better thing to do.
There is widespread support in WG14 for C semantics being uninitialized
values being unstable, so that there is no need for the two reads of x to
return the same value and x^x is also an unspecified value. See e.g.
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2221.htm>.
--
Joseph S. Myers
joseph@codesourcery.com