This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/48782] New: unused-but-set static variables are not optimized out


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]