<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=iso-8859-1">
<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;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        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="MsoNormal"><span lang="EN-US">Hello,<br>
<br>
When running Clang 3.9.0 on some Windows code (I've not yet been able to reproduce the issue with a small example), we get a crash. I've been able to see that the code crashes in checkDLLAttributeRedeclaration, more specifically in the following code:<br>
<br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas">  if (OldImportAttr && !HasNewAttr && !IsInline && !IsStaticDataMember &&<br>
      !NewDecl->isLocalExternDecl() && !IsQualifiedFriend) {<br>
    if (IsMicrosoft && IsDefinition) {<br>
      S.Diag(NewDecl->getLocation(),<br>
             diag::warn_redeclaration_without_import_attribute)<br>
          << NewDecl;<br>
      S.Diag(OldDecl->getLocation(), diag::note_previous_declaration);<br>
      NewDecl->dropAttr<DLLImportAttr>();<br>
      NewDecl->addAttr(::new (S.Context) DLLExportAttr(<br>
          NewImportAttr->getRange(), S.Context,<br>
          NewImportAttr->getSpellingListIndex()));<br>
    } else {</span><span lang="EN-US"><br>
<br>
We try to read some data from NewImportAttr, but in our case, NewImportAttr is null (which is compatible with the !HasNewAttr test). I don't really understand the logic of this code, this is why I ask for advice before changing anything... Do you think I should
 open a bug instead of discussing on the mailing list?<br>
<br>
It appears the code was changed in the following revision:<br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas">Revision: 270686<br>
Author: dzobnin<br>
Date: mercredi 25 mai 2016 13:32:42<br>
Message:<br>
[ms][dll] #26935 Defining a dllimport function should cause it to be exported<br>
<br>
If we have some function with dllimport attribute and then we have the function<br>
definition in the same module but without dllimport attribute we should add<br>
dllexport attribute to this function definition.<br>
The same should be done for variables.<br>
<br>
Example:<br>
struct __declspec(dllimport) C3 {<br>
  ~C3();<br>
};<br>
C3::~C3() {;} // we should export this definition.<br>
<br>
Patch by Andrew V. Tischenko<br>
<br>
Differential revision: </span><span style="font-size:10.0pt;font-family:Consolas"><a href="http://reviews.llvm.org/D18953" target="_blank"><span lang="EN-US">http://reviews.llvm.org/D18953</span></a></span><span lang="EN-US" style="font-size:10.0pt;font-family:Consolas"><br>
</span><span lang="EN-US"><br>
<br>
<br>
Thank you for any help,<br>
<br>
<br>
--- <br>
Loïc<br>
<br>
<br>
<br>
<o:p></o:p></span></p>
</div>
</body>
</html>