[PATCH] D22374: [analyzer] Copy and move constructors - ExprEngine extended for "almost trivial" copy and move constructors

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 05:59:16 PDT 2016


NoQ added a comment.

I see what's going on.

`performTrivialCopy()` already calls `evalBind()`, which in turn calls `runCheckersForBind()`, so no effort is needed there.

However, the bind event itself is now different - instead of a separate event for every bind, you're having only one event for binding the `nonloc::LazyCompoundVal`.

For example, in testNonPODWrapper (which calls the test on line 177), you used to have one bind of an `UndefinedVal` into `w2.p.x` (which produced the warning) and one bind of `1 S32b` into `w2.p.y`, which didn't produce the warning. But now you're having just one bind event of `lazyCompoundVal{0x7fb5b80ef3b8,w}` into `w2`. By unpacking the compound value's store, you could see that `w.p.y` in it contains an undefined value (though you wouldn't see it in the store's dump directly, the `StoreManager` would produce one for you when you ask for it).

At a glance, this might be worth fixing on the checker's side. Essentially, that might still be a problem when truly-trivial (as opposed to almost-trivial) copies are performed, so i guess the checker might need fixing regardless.

Dropping such warnings is also a viable option. We can think of this warning as false, because perhaps the purpose of this code was to ensure that at least `w2.p.y` is initialized.

But if `w` was completely unitialized (that is, LCV contained only uninitialized values in its store in the cluster defined by its parent region), then the warning should be useful. So i'm also having this feature request for all Undefined* checkers - perhaps not only consider straightforward undefined values, but also passing uninitialized structures by value or by const pointer/reference?


https://reviews.llvm.org/D22374





More information about the cfe-commits mailing list