It is a local variable, so it should be either in a register or on stack. None 
of them is initialized.
If the code does not contain any assignment of an absolute value (++ is a 
relative value) to it,
it shouldn't be initialized ever and neither produce the correct result nor 
suppress the warning.
But it is possible that the compiler uses a register for it in the inlined 
section, and before
the first inline section, the very same register actually is initialized - in a 
different context.
THis might suppress the warning. But then this is a bug. The count variable is 
not
set to a specific value anywhere in the code and therefore should produce the 
warning,
independently of a possible reuse of its storage space during the current 
function.

Unless I'm missing a C language specification that handles initialization of 
uninitialized
local variables, it is just a coincidence that the program works as expected.

However, that's just my opinion, and maybe someone with inside knowledge of the 
compiler
can shed some light on it.

If you see the inlined code, does count get set to 0 somewhere? And if so, why? 
Nobody told the compiler to do it.
Or does the code just use the very same register/variable before for a 
count-down 
at whose end it is coincidentally zero?

JMGross


----- Ursprüngliche Nachricht -----
Von: Michiel Konstapel
An: Peter Bigot
Gesendet am: 06 Jul 2011 14:11:32
Betreff: Re: [Mspgcc-users] Missing uninitialized variable warning?
 > Can you confirm that, in the generated code, there is actual reference
> to the variable that was not initialized?

Let me check... It ends up inlined several levels deep, so I couldn't find it 
in the objdump output. So I figured I'd 
__noinline__ the fuction, and hey: I do get the warning. C keeps scaring me... 
Does this mean that the compiler 
assumes I want it zeroed, and can prove it will be zero in the inlined code? Or 
does it assume I don't care, but it only 
warns me about it in some cases? Or can it simply no longer detect the error if 
the function is inlined? So, at no 
optimization, or too much optimization, you lose your warnings?


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to