<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=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
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=EN-US link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal>Hi,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>We’re considering using Clang as a just in time
compiler. It works great in a single thread, but we can’t get it
working from multiple threads.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Here’s one attempt, where we create a single execution
engine used by all threads, and one compiler instance per thread. The
result is corruption and a core dump. We’ve also tried giving each
thread its own execution engine, still no dice. This is with Clang/LLVM
2.7 on Ubuntu 9.10.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I’ve also attached a self contained zip file with the
exact compile line and code that reproduces the problem.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Any idea what we’re doing wrong?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Thanks,<o:p></o:p></p>
<p class=MsoNormal>Martin<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Here’s an example stack trace:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>*** glibc detected *** ./boom: double free or corruption
(fasttop): 0x00007fb9b421c9b0 ***<o:p></o:p></p>
<p class=MsoNormal>======= Backtrace: =========<o:p></o:p></p>
<p class=MsoNormal>/lib/libc.so.6[0x7fbabcf352f6]<o:p></o:p></p>
<p class=MsoNormal>/lib/libc.so.6(cfree+0x6c)[0x7fbabcf39c6c]<o:p></o:p></p>
<p class=MsoNormal>./boom(llvm::AttributeListImpl::DropRef()+0x3e)[0x18b4a4c]<o:p></o:p></p>
<p class=MsoNormal>./boom(llvm::AttrListPtr::operator=(llvm::AttrListPtr
const&)+0x45)[0x18b3953]<o:p></o:p></p>
<p class=MsoNormal>./boom(llvm::Function::setAttributes(llvm::AttrListPtr
const&)+0x24)[0xec2e1c]<o:p></o:p></p>
<p class=MsoNormal>./boom(llvm::Function::addAttribute(unsigned int, unsigned
int)+0x5d)[0x19101e5]<o:p></o:p></p>
<p class=MsoNormal>./boom(llvm::Argument::addAttr(unsigned
int)+0x32)[0x191094a]<o:p></o:p></p>
<p class=MsoNormal>./boom((anonymous namespace)::FunctionAttrs::AddNoCaptureAttrs(std::vector<llvm::CallGraphNode*,
std::allocator<llvm::CallGraphNode*> > const&)+0x131)[0x12e3f05]<o:p></o:p></p>
<p class=MsoNormal>./boom((anonymous
namespace)::FunctionAttrs::runOnSCC(std::vector<llvm::CallGraphNode*,
std::allocator<llvm::CallGraphNode*> >&)+0x32)[0x12e464e]<o:p></o:p></p>
<p class=MsoNormal>./boom((anonymous
namespace)::CGPassManager::RunPassOnSCC(llvm::Pass*,
std::vector<llvm::CallGraphNode*, std::allocator<llvm::CallGraphNode*>
>&, llvm::CallGraph&, bool&)+0xa8)[0x17fafb4]<o:p></o:p></p>
<p class=MsoNormal>./boom((anonymous namespace)::CGPassManager::runOnModule(llvm::Module&)+0x24e)[0x17fb418]<o:p></o:p></p>
<p class=MsoNormal>./boom(llvm::MPPassManager::runOnModule(llvm::Module&)+0x17e)[0x194930c]<o:p></o:p></p>
<p class=MsoNormal>./boom(llvm::PassManagerImpl::run(llvm::Module&)+0x6f)[0x194b0b1]<o:p></o:p></p>
<p class=MsoNormal>./boom(llvm::PassManager::run(llvm::Module&)+0x21)[0x194b113]<o:p></o:p></p>
<p class=MsoNormal>./boom((anonymous
namespace)::BackendConsumer::EmitAssembly()+0x241)[0xdfc3f9]<o:p></o:p></p>
<p class=MsoNormal>./boom((anonymous
namespace)::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)+0x91)[0xdffcef]<o:p></o:p></p>
<p class=MsoNormal>./boom(clang::ParseAST(clang::Preprocessor&,
clang::ASTConsumer*, clang::ASTContext&, bool, bool,
clang::CodeCompleteConsumer*)+0x2a4)[0xfc7164]<o:p></o:p></p>
<p class=MsoNormal>./boom(clang::ASTFrontendAction::ExecuteAction()+0x100)[0xe177a2]<o:p></o:p></p>
<p class=MsoNormal>./boom(clang::FrontendAction::Execute()+0xe2)[0xe17892]<o:p></o:p></p>
<p class=MsoNormal>./boom(clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)+0x2a3)[0xe01427]<o:p></o:p></p>
<p class=MsoNormal>./boom(go(void*)+0x25f)[0xdf64f3]<o:p></o:p></p>
<p class=MsoNormal>/lib/libpthread.so.0[0x7fbabd9e0a04]<o:p></o:p></p>
<p class=MsoNormal>/lib/libc.so.6(clone+0x6d)[0x7fbabcf9ed4d]<o:p></o:p></p>
</div>
</body>
</html>