[Bug c++/11211] trivial static initializers of const objects should be done at compile time
bangerth@dealii.org
gcc-bugzilla@gcc.gnu.org
Mon Jun 16 19:09:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11211
------- Additional Comments From bangerth@dealii.org 2003-06-16 19:06 -------
IIRC, the standard prescribes that these objects be placed in a memory
location that is originally zero-initialized, and only set when the
constructor is run. So the behavior is correct, but I'd like to
hear from a language lawyer. (There is a related PR somewhere we this
was discussed in great detail -- ah, PR 9881. And PR 4131 may also
be related.)
The question then is: is there a program which can detect the difference?
I think in this case, you can: the variable is declared externally visible,
so constructors of other variables running in a different translation
unit before the constructors of this unit may access the memory of this
unit.
But as I said, some language lawyer will tell whether this optimization can
be done or not.
W.
More information about the Gcc-bugs
mailing list