[cfe-dev] uninitialized variable warning, etc

Ted Kremenek kremenek at apple.com
Fri Mar 6 14:54:44 PST 2009


Daniel,

I think this is a matter of mapping -Wuninitialized to running the  
same logic as -warn-unit-values.  That logic is just a simple flow- 
sensitive check.

On Mar 6, 2009, at 12:21 PM, Daniel Dunbar wrote:

> Hi,
>
> clang does not yet implement the uninitialized values warning outside
> of the static analysis engine.
> --
> ddunbar at lordcrumb:tmp$ cat t4.c
> int f0(void)  {
>  int b;
>  return b;
> }
> ddunbar at lordcrumb:tmp$ ccc --analyze t4.c
> t4.c:3:3: warning: Uninitialized or undefined return value returned  
> to caller.
>  return b;
>  ^
> 1 diagnostic generated.
> --
>
> Feel free to file a bug if you like; however this is the sort of
> warning that the static analyzer is much more suited to emitting. We
> never want to have the gcc behavior where warnings depend on
> optimization level or have warnings emitted by the backend.
>
> On Thu, Mar 5, 2009 at 6:36 PM,  <rdogra at earthlink.net> wrote:
>> libavcodec/dsputil.c:3966:10: warning: use of unary operator that may
>> be intended as compound assignment (-=)
>>    for(i=-len, j=len-1; i<0; i++, j--) {
>>         ^~
>
> Yes; we may well end up disabling this warning by default as it
> appears to be quite noisy on some code bases.
>
> - Daniel
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list