Like PR c/43981, but still happening with 4.6.0 20100513 (Last Changed Rev: 159356 ), which is why I copied and editted the title.
In case a const variable is used for array sizing it is not considered to be read whereas a non-const variable would be considered to be read. It does NOT happen when using gcc on a .c file, but it happens when using g++ on a .cpp file, as such component c++. See the attached test case which shows that only the const variables are affected by this. -- Summary: [4.6 Regression] -Wunused-but-set-variable does not consider array sizing use of a const variable Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rubidium at openttd dot org GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44108