[LLVMbugs] [Bug 3767] New: static initializer-based registration mechanism not portable

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Mar 9 14:19:33 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=3767

           Summary: static initializer-based registration mechanism not
                    portable
           Product: new-bugs
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu


Throughout the code, LLVM uses statically initialized variables with the
expectation that they will run before main. One example is registering the
possible backends, and the other is registering command line flags.

Quoth the Standard: It is implementation-defined whether or not the dynamic
initialization (8.5, 9.4, 12.1, 12.6.1) of an object of namespace scope is done
before the first statement of main. If the initialization is deferred to some
point in time after the first statement of main, it shall occur before the
first use of any function or object defined in the same translation unit as the
object to be initialized.

This mean that a static initializer need not execute until another function in
the TU is called. This comes up in MSVC++ and Windows.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list