<div dir="ltr"><div><div><div><div><div><div><div><div>Hello,<br></div>Today  I encountered a problem when viewing some code.<br></div><div>When executing the complied binary it aborted and give the error message.<br>"initializer for function local static variable called enclosing function"<br>
   <br></div><div><br></div>The code is like this,<br></div>       static bool isDumpEnabled = getenv("env_dump_something") ! = 0<br><br></div>When executing this code, this error occurred once.<br></div>But I don't know why. <br>
I had a look at the code in this page,<br><a href="http://www.opensource.apple.com/source/libcppabi/libcppabi-26/src/cxa_guard.cxx">http://www.opensource.apple.com/source/libcppabi/libcppabi-26/src/cxa_guard.cxx</a><br><br>
</div>It seems the error is because that  initializing static variable twice in one thread.<br><br></div>Is that possible, or it is a optimization error for llvm?<br><br><br></div>Any tips are welcome!<br><div><div><div> <br clear="all">
<div><div><div><div><div><div><br>-- <br>You'll succeed if you try your best.
</div></div></div></div></div></div></div></div></div></div>