<div>Repro looks like this:</div><div><br></div>extern "C" {<div>  void f() { static int n = 1; }</div><div>  void g() { static long long n = 2; }</div><div>}</div><div><br></div><div>The root cause seems to be that we don't mangle static locals inside an extern "C" block. (For reference, g++ does.)<br>
<br><div class="gmail_quote">On Fri, Mar 30, 2012 at 12:13 AM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mar 29, 2012, at 10:13 PM, Eli Friedman wrote:<br>
> On Thu, Mar 29, 2012 at 9:46 PM, John McCall <<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>> wrote:<br>
>> On Mar 29, 2012, at 9:41 PM, Eli Friedman wrote:<br>
</div><div class="im">>>> This check won't work reliably: the global's type isn't guaranteed to<br>
>>> be the same as the IR type of the variable.<br>
>><br>
>> Is there a situation you have in mind where the type check I've got would<br>
>> be inadequate?<br>
><br>
> B::B() {<br>
>  union U { void* x; long double y; };<br>
>  static U u = { (void*)&u };<br>
> }<br>
<br>
</div>Right you are.  r153733 tries to keep some of the value of the check<br>
while still handling this.<br>
<span class="HOEnZb"><font color="#888888"><br>
John.<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div>