The following (simplified) code originates from peren_c++ (Sec6/7/R06263.r0):
#include <stdio.h> int ctor_calls; class A { int x; public: // check that was 0 before initialized A() {ctor_calls++;} }; main(){ for(int i =0; i < 10; i++) static A a; printf("%d\n", ctor_calls); } The output with 3.4.6 port is "0", with 4.3.2 it is "10" (-O0,-O2). -- Summary: Ignored static qualifier on a local variable Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sergei_lus at yahoo dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39967