[PATCH] D103495: [static initializers] Don't put ordered dynamic initializers of static variables into global_ctors
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 7 15:36:33 PDT 2021
rnk added subscribers: MaskRay, mstorsjo.
rnk added a comment.
+ various .ctors stakeholders + @MaskRay + @mstorsjo
This change was my idea, so I want to make sure there is buy in from other folks who use -fno-init-array. This has the potential to break user programs that rely on the order of dynamic initialization *within* a TU, but there will be no change in order between TUs. This might also deserve a release note.
Overall this should be a positive change. In the past users have reported QoI issues where a template with an SDM instantiated earlier in the TU gets initialized after a template instantiated later in the TU. Technically, those initializers are not ordered, so this is not a correctness issue, but it would be nicer if initializers ran in source order.
We might need to add docs here about what happens when the initializer is in a comdat group, since the order guarantee in that case is very subtle.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103495/new/
https://reviews.llvm.org/D103495
More information about the cfe-commits
mailing list