Are we sure this is correct? In the motivating example, what if 'f' gets
inlined? Then 'g' will have the code of 'f' embedded into it, but it will
not be part of the comdat that statically initializes the guard variable.
struct S {
static const int x;
};
// const int S::x = 42;
inline const int *f() {
static const int y = S::x;
return &y;
}
const int *g() { return f(); }
I spent a coffee break a few weeks ago worrying about this, and we came to
the conclusion that we can't do this if we want to support inlining from a
comdat. Maybe it's illegal for LLVM to inline f from a comdat, but that's
pretty sad.
On Tue, Dec 16, 2014 at 1:02 PM, Rafael Espíndola <
[email protected]> wrote:
>
> On 1 November 2014 at 14:29, Richard Smith <[email protected]> wrote:
> > Thanks, that sounds ideal.
>
> Finally fixed by r224369. Sorry for the delay.
>
> Cheers,
> Rafael
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits