r192570 - Fixed "ArgSize may be used uninitialised" error whencompiling with gcc.
Andy Gibbs
andyg1001 at hotmail.co.uk
Mon Oct 14 23:20:38 PDT 2013
On Monday, October 14, 2013 6:16 PM, David Blaikie wrote:
> Generally I believe we would prefer to disable the warning
> than needlessly initialize the variable (is this needless
> initialization? I haven't looked at the rest of the code,
> but I assume it is). That way dynamic tools (MSan, Valgrind,
> etc) can properly diagnose when the algorithm has bugs that
> fail to initialize this variable.
And on Monday, October 14, 2013 6:33 PM, Robert Lytton wrote:
> Hi David,
>
> Just to confirm that the initialization was needless.
> All enum types are covered in switch statement.
> Each case assigns to the variable.
Yes, each case assigns to the variable (even the one with the
llvm_unreachable), but gcc seems to be over-zealous with this
warning and doesn't consider the switch statement to be fully
covered. I think it happens under some specific optimisation
level, but I don't know the ins and outs of it, this is just
the impression I've gathered over time.
David, what would be the best best way to disable the warning
here? I take your point about using dynamic tools, but the
code in its current state will not compile under release mode
with -Werror on gcc. I wouldn't want to do some sort of
kluge in the order of a diagnostic pragma; would you be happy
with an alternative kludge: a LLVM_WEAK_INITIALIZE(...) macro
inside llvm/Compiler.h that expands to nothing unless using
gcc? I guess there are loads of places across the whole code
where this might be used; I don't think this is an isolated
case of a technically unnecessary initialisation.
Cheers
Andy
More information about the cfe-commits
mailing list