[llvm-commits] [llvm] r158638 - in /llvm/trunk: include/llvm/ADT/DenseMap.h unittests/ADT/DenseMapTest.cpp

Chandler Carruth chandlerc at google.com
Mon Jun 18 09:19:22 PDT 2012


On Mon, Jun 18, 2012 at 8:37 AM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Chandler,
>
> > The codebase already has piles of these incorrect warnings in it,
>
> maybe clang does but LLVM proper does not, so why not keep it that way?


Because the warning is broken. Fundamentally.

There is no way to work around the warning that does not make the code
worse. If the GCC optimizer cannot *prove* that the value is initialized,
or does not hit one of its magical "don't warn on this" signals (usually
escaped address to an external function), it calls it uninitialized.

If you initialize it blindly, then any actual bug you might have in your
code will fail to be reported by Valgrind and other tools that really can
detect uninitialized uses.

Now, maybe I've introduced a bug into this code and the warning is
legitimate. I'll look into that. But I am completely opposed to changing
code to be less readable, less accurate, less efficient, or less easy for
Valgrind to check to satisfy a poorly implemented warning when we have
better alternatives.

We should rely on Clang's -Wuninitialized and on Valgrind to catch our bugs.
-Chandler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120618/ec1081aa/attachment.html>


More information about the llvm-commits mailing list