[PATCH] D26442: [analyzer] Fix crash on getSVal: handle case of CompoundVal
Artem Dergachev via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 10 11:40:14 PST 2016
NoQ added a comment.
Wow, this crash must have been hard to notice!
I think we shouldn't be default-binding non-lazy compound values. Normally we unpack them into field bindings right away, but it seems that nobody cared to implement this for unions.
The current crash goes through `RegionStoreManager::bind()`,
2000 if (Ty->isVectorType())
2001 return bindVector(B, TR, V);
2002 if (Ty->isUnionType())
-> 2003 return bindAggregate(B, TR, V);
I think that instead of doing `bindAggregate()`, we should do something similar to what `RegionStoreManager::bindStruct()` does (the code that handles compound values should probably be factored out). It should be even easier because unions hold only one value.
I'm not sure if my suggestion has any immediate benefits to overweight its complexity, but it should make improving support for unions easier in the future.
Also, the code for the lazy compound value is really out of place here. All it does is works around the huge and famous FIXME in `getBindingForFieldOrElementCommon()`. But i don't think we should grow this FIXME into unions.
Repository:
rL LLVM
https://reviews.llvm.org/D26442
More information about the cfe-commits
mailing list