[cfe-commits] r153723 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp lib/CodeGen/ItaniumCXXABI.cpp test/CodeGenCXX/static-init.cpp
Richard Smith
richard at metafoo.co.uk
Fri Mar 30 01:06:40 PDT 2012
Repro looks like this:
extern "C" {
void f() { static int n = 1; }
void g() { static long long n = 2; }
}
The root cause seems to be that we don't mangle static locals inside an
extern "C" block. (For reference, g++ does.)
On Fri, Mar 30, 2012 at 12:13 AM, John McCall <rjmccall at apple.com> wrote:
> On Mar 29, 2012, at 10:13 PM, Eli Friedman wrote:
> > On Thu, Mar 29, 2012 at 9:46 PM, John McCall <rjmccall at apple.com> wrote:
> >> On Mar 29, 2012, at 9:41 PM, Eli Friedman wrote:
> >>> This check won't work reliably: the global's type isn't guaranteed to
> >>> be the same as the IR type of the variable.
> >>
> >> Is there a situation you have in mind where the type check I've got
> would
> >> be inadequate?
> >
> > B::B() {
> > union U { void* x; long double y; };
> > static U u = { (void*)&u };
> > }
>
> Right you are. r153733 tries to keep some of the value of the check
> while still handling this.
>
> John.
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120330/8358d862/attachment.html>
More information about the cfe-commits
mailing list