[llvm] r176341 - GCC thinks that this variable might be used uninitialized (it isn't).

Duncan Sands baldrick at free.fr
Mon Mar 11 09:32:40 PDT 2013


Hi Michael,

On 01/03/13 18:01, Michael Liao wrote:
> On Fri, 2013-03-01 at 02:50 -0800, Chandler Carruth wrote:
>>
>> On Fri, Mar 1, 2013 at 1:46 AM, Duncan Sands <baldrick at free.fr> wrote:
>>          GCC thinks that this variable might be used uninitialized (it
>>          isn't).
>>
>>
>> Sorry to keep kicking the horse here, but I really oppose adding dead
>> stores to silence a broken warning.
>>
>>
>> We'll no longer be able to use Valgrind to catch a bug where the
>> control flow that intends to initialize this variable suddenly changes
>> and fails to do so in one case. =[ That seems really bad.
>>
>>
>> Clang's warnings don't have this false positive, and there is even a
>> way to silence GCCs in modern GCCs (-Wno-maybe-uninitialized) because
>> of this problem. Can we just turn off old GCC -Wuninitialized and rely
>> on the modern compilers' warnings instead?
>
> shall we add that option by default in our makefile*?

actually it is already there!

$ ./llvm-config --cxxflags
-I/home/duncan/LLVM/llvm/include -I/home/duncan/LLVM/llvm-objects/include  -fPIC 
-fvisibility-inlines-hidden -Wno-maybe-uninitialized -O2 -g  -D_GNU_SOURCE -Wall 
-W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers 
-pedantic -Wno-long-long -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS 
-D__STDC_LIMIT_MACROS

Maybe the problem is that -Wall turns on -Wmaybe-uninitialized, and as -Wall
comes after -Wno-maybe-uninitialized it perhaps nullifies that option.

Ciao, Duncan.



More information about the llvm-commits mailing list