The call to hasExternalFormalLinkage in CGDecl.cpp should be to hasExternalStorage. Consider:<div><br></div><div>namespace {</div><div>  int a;</div><div><br></div><div>  int f() {</div><div>    extern int a;</div><div>    return a;</div>
<div>  }</div><div>}</div><div><br></div><div>Here, the 'a' inside 'f' has InternalLinkage but ExternalStorage. We definitely don't want to emit that as an automatic-storage-duration variable. Please also add an assert(D.hasLocalStorage()) before the call to EmitAutoVarDecl.<br>
<br><div class="gmail_quote">On Tue, May 14, 2013 at 6:08 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.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">> Here is a tentative fix for review: the switch on the storage class "as<br>
> written" is replaced by calls to semantics-aware methods.<br>
> (Note: as I said previously, I am not changing the special handling of<br>
> SC_OpenCLWorkGroupLocal storage class.)<br>
<br>
</div>Please include the test in the patch.<br>
<br>
> Enea.<br>
><br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div>