This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Annoying silly warning emitted by gcc?
- From: Warren D Smith <warren dot wds at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 23 Jan 2019 19:15:38 -0500
- Subject: Annoying silly warning emitted by gcc?
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.
--
Warren D. Smith
http://RangeVoting.org <-- add your endorsement (by clicking
"endorse" as 1st step)