> Hmm, why do you not do this for static local variables? They have the same
> issue, as far as I can see.
I was playing with
struct S {
static const int x;
};
// const int S::x = 42;
inline int *f() {
static int y = S::x;
return &y;
}
int *g() { return f(); }
and I can't get it to produce invalid code. The main difference is
that without a static constructor there is never an always run piece
of code that assumes that it has to write to y. We also put y in a rw
section even when S::x is defined, but I think that is a bug (and will
report it in a sec).
Having said that, it would probably be profitable to put the variable
and the guard in the same comdat as the inline function. Is that what
you had in mind?
Cheers,
Rafael
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits