http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48779
Summary: -Wunused-but-set-variable does not report unread unit-static variables Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: flamee...@gentoo.org I know this is likely cumbersome to support as a case, as it requires to look at all the functions in the given unit to report it, but since GCC already reports unused functions in the unit I guess it is feasible. Simple test case: static unsigned int done = 0; int main() { done = 1; return 0; } The warning works fine if done is function-static though. Thanks, Diego