[LLVMbugs] [Bug 9878] New: Constructor's/Destructor's priorities are ignored
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon May 9 08:11:38 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9878
Summary: Constructor's/Destructor's priorities are ignored
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: tim.nieradzik at gmx.de
CC: llvmbugs at cs.uiuc.edu
GCC supports specifying priorities for constructors and destructors:
"You may provide an optional integer priority to control the order in which
constructor and destructor functions are run. A constructor with a smaller
priority number runs before a constructor with a larger priority number; the
opposite relationship holds for destructors. So, if you have a constructor that
allocates a resource and a destructor that deallocates the same resource, both
functions typically have the same priority. [...]"
(Source: http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html)
Clang, however, ignores the priorities. Therefore, the attached example prints:
ctor2()
ctor1()
ctor0()
main()
dtor0()
dtor1()
dtor2()
Whereas the correct output would have been:
ctor0()
ctor1()
ctor2()
main()
dtor2()
dtor1()
dtor0()
--
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