[cfe-dev] Inlining temporary destructors in the analyzer
Manuel Klimek
klimek at google.com
Wed Jul 30 08:14:44 PDT 2014
Hi Jordan,
I made some progress on inlining temporary destructors. My main problem
currently is that somehow the initializer values in my constructor get lost
if I don't also reference 'this' via some other way.
An examples shows that best. Consider:
struct A {
A(int* y) : z(y) {}
~A() { *z = 23; }
int *z;
};
void f() {
int x = 0;
{(A(&x));}
}
This leads to a "Dereference of undefined pointer value" warning on *z = 23.
Funnily enough this warning goes away (and all values get correctly
propagated) if change the constructor to be:
A(int* y) : z(y) { (void)this; }
Obviously this also works fine if I use a local variable instead of a
temporary.
Any ideas what might be going wrong here would be greatly appreciated.
Thanks!
/Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140730/1d2a41f3/attachment.html>
More information about the cfe-dev
mailing list