[Bug c/48779] New: -Wunused-but-set-variable does not report unread unit-static variables

flameeyes at gentoo dot org gcc-bugzilla@gcc.gnu.org
Tue Apr 26 20:50:00 GMT 2011


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: unassigned@gcc.gnu.org
        ReportedBy: flameeyes@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



More information about the Gcc-bugs mailing list