This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21089] [4.0/4.1 Regression] C++ front-end does not "inline" the static const double
- From: "sabre at nondot dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Apr 2005 18:41:09 -0000
- Subject: [Bug c++/21089] [4.0/4.1 Regression] C++ front-end does not "inline" the static const double
- References: <20050418172616.21089.matz@suse.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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