[cfe-dev] [analyzer] Should we invalidate the `this` pointer?

Artem Dergachev via cfe-dev cfe-dev at lists.llvm.org
Sun Apr 1 17:31:42 PDT 2018


This assertion is pretty fundamental. Invalidation, if done correctly, 
should not have triggered it - after all, invalidation could occur for 
any other reason, not necessarily because of loop widening.

Invalidation of this-region contents (that is, not of the 
CXXThisObjectRegion of the current stack frame, but of the actual 
this-region which is a pointee of the CXXThisObjectRegion) sounds 
reasonable if the region is modified within the loop - which is going to 
often be the case.

On 3/31/18 2:02 AM, Henry Wong via cfe-dev wrote:
> Hi all,
>
> I recently encountered a assertion failure as shown below.
>
> `Assertion `!InitValWithAdjustments.getAs<Loc>() || 
> Loc::isLocType(Result->getType()) || 
> Result->getType()->isMemberPointerType()' failed`
>
> The code that will trigger this assertion failed.
> ----------------------------------------------------------------------------------------------------
> struct BlockId {
> BlockId();
> };
>
> void goo(BlockId id);
>
> BlockId::BlockId() {
> int count = 10;
> do {
>
> } while (count--);
> }
>
> int main() {
> goo(BlockId());
> }
> ----------------------------------------------------------------------------------------------------
>
> The reason is that the analyzer invalidate the `this` pointer 
> at loop-widen. The more essential question is "Should we invalidate 
> the `this` pointer?"
>
> Thanks in advance!
>
> Henry Wong
> Qihoo 360 Codesafe Team
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list