clang does not warn for Uninitialized Array's

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

clang does not warn for Uninitialized Array's

Alex Denisov via cfe-dev
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.

<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 ?


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang does not warn for Uninitialized Array's

Alex Denisov via cfe-dev
On Nov 6, 2017, at 1:42 AM, Mahesh Attarde via cfe-dev <[hidden email]> 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 ?


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev