http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48782

           Summary: unused-but-set static variables are not optimized out
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: flamee...@gentoo.org


int main() {
  static unsigned char done = 0;

  done = 1;
  return 1;
}

The done variable is properly reported as unused-but-set by gcc but both the
"done = 1" store and the memory area itself is kept in the produced code up to
-O3.

Reply via email to