------- Additional Comments From sabre at nondot dot org 2005-04-18 18:41
-------
Is this optimization valid? Note that it will change the behavior of this c++
program:
----
#include <stdio.h>
static const double X = 1.0;
static struct S { S(); } s;
static const double Y = X+2.0;
S::S() {
printf("%f\n", Y);
}
int main() {}
----
In particular, I think the C++ standard specifies that memory is zero
initialized and then ctors (within a translation unit) are run in order. IANALL
though.
-Chris
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21089