[LLVMdev] initializer for function local static variable called enclosing function

彭洪勇 phy666 at gmail.com
Sat Apr 27 10:09:28 PDT 2013


Hello,
Today  I encountered a problem when viewing some code.
When executing the complied binary it aborted and give the error message.
"initializer for function local static variable called enclosing function"


The code is like this,
       static bool isDumpEnabled = getenv("env_dump_something") ! = 0

When executing this code, this error occurred once.
But I don't know why.
I had a look at the code in this page,
http://www.opensource.apple.com/source/libcppabi/libcppabi-26/src/cxa_guard.cxx

It seems the error is because that  initializing static variable twice in
one thread.

Is that possible, or it is a optimization error for llvm?


Any tips are welcome!


-- 
You'll succeed if you try your best.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130428/bc0a07d1/attachment.html>


More information about the llvm-dev mailing list