Annoying silly warning emitted by gcc?
Andrew Pinski
pinskia@gmail.com
Thu Jan 24 01:04:00 GMT 2019
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)
More information about the Gcc
mailing list