During pointer dereferencing CastRetrievedVal uses wrong type from the Store after type punning. Namely, the pointer casts to another type and then assigns with a value of one more another type. It produces NonLoc value when Loc is expected.
Example for visibility:
void foo(char ***c, int *i) { *(unsigned**)c = (unsigned*)i; // type punning ***c; // uses 'unsigned**' from the Store instead of 'char***' }
Fixes:
https://bugs.llvm.org/show_bug.cgi?id=37503
https://bugs.llvm.org/show_bug.cgi?id=49007
This caused some problems with assertion failures, see https://bugs.llvm.org/show_bug.cgi?id=50179