This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
int foo(int i) { char buffer[10]; return buffer[i]; } does not warn about the use of uninitialized array buffer. While int foo(int i) { char buffer[10]; return buffer[2]; } does. Likewise for C++.
Related to PR 10138.
(In reply to comment #0) [first testcase using nonconstant index] > > does not warn about the use of uninitialized array buffer. While > [second testcase using constant index] > > does. Likewise for C++. In the second example, SRA works on the array, scalarizes the array which allows for the current initialization warning to happen. Now maybe we should do the uninitialization warning in the front-end.
*** Bug 35234 has been marked as a duplicate of this bug. ***