This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/50986] weak static data members with constant initializers emitted in .rodata, leading to segfault on startup


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50986

--- Comment #2 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> 2012-02-01 21:14:35 UTC ---
As noted in comment#0, I believe there is no ODR violation here. Each
definition of U<S>::k consists of the same sequence of tokens, every name
refers to the same entity in both definitions, and none of the other provisions
of [basic.def.odr]p5 applies.

After some discussion, the proposed approach in clang is (roughly) to always
generate a guard variable (initialized to 1 for a statically-initialized
variable), and to put the variable and its guard variable in the same COMDAT
group. Full details are in this thread:

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-November/018816.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]