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: Andrew Pinski <pinskia at gmail dot com>
- To: Warren D Smith <warren dot wds at gmail dot com>
- Cc: GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Wed, 23 Jan 2019 17:03:42 -0800
- Subject: Re: Annoying silly warning emitted by gcc?
- References: <CAAJP7Y1Dc0DWBO7UsTcYxjsofx9a8zQOtKFc=UhvY2Ck5h3GmA@mail.gmail.com>
On Wed, Jan 23, 2019 at 4:16 PM Warren D Smith <warren.wds@gmail.com> 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.
>
> But the problem is, gcc complains:
> variable 'x' is uninitialized when used here [-Wuninitialized]
> note: initialize the variable 'x' to silence this warning
>
> Well, the thing is, it DOES NOT MATTER that x is not initialized,
> or initialized with wrong data. No matter what was in x, it becomes 0.
>
> So, how to get Gcc to shut up and quit whining about this?
> I do not want to actually load 0.
I don't see why you think the compiler will not do the right thing and
do the xor trick when there is a zero in the code.
Thanks,
Andrew Pinski
>
> --
> Warren D. Smith
> http://RangeVoting.org <-- add your endorsement (by clicking
> "endorse" as 1st step)