<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Texte brut Car";
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.TextebrutCar
{mso-style-name:"Texte brut Car";
mso-style-priority:99;
mso-style-link:"Texte brut";
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FR" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoPlainText">Hello again,<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><span lang="EN-US">I've finally been able to reduce it to a working example. I can only get this when trying to compile incorrect code (a missing header), but I think it should not crash anyway:<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:gray">#include</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#A31515">"Zorg.h"</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:green">// Non existing file</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">template</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">typename</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">_Tp</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">, std::size_t _Nm = 42><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">struct</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">array</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">};<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">class</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">__declspec</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">(</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">dllimport</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">)
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">DBConnectivity</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">static</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">bool</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"> myFunc(</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">array</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">int</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">>
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:gray">args</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">};<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">bool</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">DBConnectivity</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">::myFunc(</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">array</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">int</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">>
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:gray">args</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">}<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">I’ll fill a Bugzilla issue as soon as I have an account (it looks like this is required, I’ve just sent a mail to
<a href="mailto:llvm-admin@lists.llvm.org">llvm-admin@lists.llvm.org</a>).<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">--- <o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">Loïc Joly<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText"><a name="_MailEndCompose"><span lang="EN-US"><o:p> </o:p></span></a></p>
<p class="MsoPlainText"><span style="mso-fareast-language:FR">-----Message d'origine-----<br>
De : hwennborg@google.com [mailto:hwennborg@google.com] De la part de Hans Wennborg<br>
Envoyé : lundi 14 novembre 2016 19:39<br>
À : Loïc Joly <l.joly@castsoftware.com><br>
Cc : cfe-dev@lists.llvm.org; d.zobnin.bugzilla@gmail.com<br>
Objet : Re: [cfe-dev] Issue with checkDLLAttributeRedeclaration in SemaDecl.cpp</span></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">+Denis who wrote r270686<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Yes, if you can report this on the Bugzilla that would be better.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">If you can provide the preprocessed source and command-line (Clang should be writing these to files in your temp dir when it crashes), I can try to reduce it for you.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Thanks,<o:p></o:p></p>
<p class="MsoPlainText">Hans<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><span lang="EN-US">On Mon, Nov 14, 2016 at 9:39 AM, Loïc Joly via cfe-dev <</span><a href="mailto:cfe-dev@lists.llvm.org"><span lang="EN-US" style="color:windowtext;text-decoration:none">cfe-dev@lists.llvm.org</span></a><span lang="EN-US">>
wrote:<o:p></o:p></span></p>
<p class="MsoPlainText">> Hello,<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> When running Clang 3.9.0 on some Windows code (I've not yet been able
<o:p></o:p></p>
<p class="MsoPlainText">> to reproduce the issue with a small example), we get a crash. I've
<o:p></o:p></p>
<p class="MsoPlainText">> been able to see that the code crashes in <o:p></o:p></p>
<p class="MsoPlainText">> checkDLLAttributeRedeclaration, more specifically in the following code:<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> if (OldImportAttr && !HasNewAttr && !IsInline && !IsStaticDataMember &&<o:p></o:p></p>
<p class="MsoPlainText">> !NewDecl->isLocalExternDecl() && !IsQualifiedFriend) {<o:p></o:p></p>
<p class="MsoPlainText">> if (IsMicrosoft && IsDefinition) {<o:p></o:p></p>
<p class="MsoPlainText">> S.Diag(NewDecl->getLocation(),<o:p></o:p></p>
<p class="MsoPlainText">> diag::warn_redeclaration_without_import_attribute)<o:p></o:p></p>
<p class="MsoPlainText">> << NewDecl;<o:p></o:p></p>
<p class="MsoPlainText">> S.Diag(OldDecl->getLocation(), diag::note_previous_declaration);<o:p></o:p></p>
<p class="MsoPlainText">> NewDecl->dropAttr<DLLImportAttr>();<o:p></o:p></p>
<p class="MsoPlainText">> NewDecl->addAttr(::new (S.Context) DLLExportAttr(<o:p></o:p></p>
<p class="MsoPlainText">> NewImportAttr->getRange(), S.Context,<o:p></o:p></p>
<p class="MsoPlainText">> NewImportAttr->getSpellingListIndex()));<o:p></o:p></p>
<p class="MsoPlainText">> } else {<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> We try to read some data from NewImportAttr, but in our case,
<o:p></o:p></p>
<p class="MsoPlainText">> NewImportAttr is null (which is compatible with the !HasNewAttr test).
<o:p></o:p></p>
<p class="MsoPlainText">> I don't really understand the logic of this code, this is why I ask
<o:p></o:p></p>
<p class="MsoPlainText">> for advice before changing anything... Do you think I should open a
<o:p></o:p></p>
<p class="MsoPlainText">> bug instead of discussing on the mailing list?<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> It appears the code was changed in the following revision:<o:p></o:p></p>
<p class="MsoPlainText">> Revision: 270686<o:p></o:p></p>
<p class="MsoPlainText">> Author: dzobnin<o:p></o:p></p>
<p class="MsoPlainText">> Date: mercredi 25 mai 2016 13:32:42<o:p></o:p></p>
<p class="MsoPlainText">> Message:<o:p></o:p></p>
<p class="MsoPlainText">> [ms][dll] #26935 Defining a dllimport function should cause it to be
<o:p></o:p></p>
<p class="MsoPlainText">> exported<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> If we have some function with dllimport attribute and then we have the
<o:p></o:p></p>
<p class="MsoPlainText">> function definition in the same module but without dllimport attribute
<o:p></o:p></p>
<p class="MsoPlainText">> we should add dllexport attribute to this function definition.<o:p></o:p></p>
<p class="MsoPlainText">> The same should be done for variables.<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> Example:<o:p></o:p></p>
<p class="MsoPlainText">> struct __declspec(dllimport) C3 {<o:p></o:p></p>
<p class="MsoPlainText">> ~C3();<o:p></o:p></p>
<p class="MsoPlainText">> };<o:p></o:p></p>
<p class="MsoPlainText">> C3::~C3() {;} // we should export this definition.<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> Patch by Andrew V. Tischenko<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText"><span lang="EN-US">> Differential revision: </span><a href="http://reviews.llvm.org/D18953"><span lang="EN-US" style="color:windowtext;text-decoration:none">http://reviews.llvm.org/D18953</span></a><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> Thank you for any help,<o:p></o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">><o:p> </o:p></p>
<p class="MsoPlainText">> ---<o:p></o:p></p>
<p class="MsoPlainText">> Loïc<o:p></o:p></p>
</div>
</body>
</html>