This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/48782] New: unused-but-set static variables are not optimized out
- From: "flameeyes at gentoo dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 26 Apr 2011 23:38:46 +0000
- Subject: [Bug c/48782] New: unused-but-set static variables are not optimized out
- Auto-submitted: auto-generated
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.