[PATCH] Proposal on how to fix temporary dtors.
Manuel Klimek
klimek at google.com
Mon May 26 08:18:49 PDT 2014
================
Comment at: lib/Analysis/CFG.cpp:3549
@@ -3599,3 +3548,3 @@
if (Dtor->isNoReturn()) {
Succ = B;
Block = createNoReturnBlock();
----------------
The actual problem was here:
Instead of unconditionally setting Succ to B, we have to do:
if (B) Succ = B;
(like below).
The problem is that this leads to new regressions (which are correct to regress :P).
Consider:
struct abort {
abort();
~abort() __attribute__((noreturn));
};
int f1(int x) {
switch (x)
default:
abort();
}
The problem is that with the new way the CFG is built for temp dtors, we'll get a "branch" at destruction time of the abort, that either doesn't return (good), or falls through to the normal path (oh noes).
Of course there is no path where the constructor wasn't executed, but a simple path based analysis doesn't know that (UnreachableCode.cpp).
The idea to fix that would be to only insert the decision blocks for temporary destructors if we are at a branching point, and otherwise just flow up like normal.
Other ideas / thoughts?
http://reviews.llvm.org/D3627
More information about the cfe-commits
mailing list