[cfe-dev] clang does not warn for Uninitialized Array's

John McCall via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 6 01:05:17 PST 2017


> On Nov 6, 2017, at 1:42 AM, Mahesh Attarde via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> Hello 
> I tried to run simple check with following example
> 
> int foo(){
>     int f[10];
>     return  f[0];
> }
> 
> with clang 5.0.0   -Wuninitialized    There is no error.
> 
> with gcc 7.2.0     -Wuinitialized  we get error.

I'm sure it's just a limitation of our current analysis that could be fixed.  It's worth a bug, yes.

John.

> 
> <source>: In function 'int foo()':
> 5 : <source>:5:16: warning: 'f[0]' is used uninitialized in this function [-Wuninitialized]
>      return  f[0];
>                 ^
> Compiler exited with result code 0
> 
> Wonder why?
> Should i raise request on bugzilla ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171106/256e65a1/attachment-0001.html>


More information about the cfe-dev mailing list