ASDenysPetrov added a comment.

@NoQ

> The new code should obviously be restricted into evalCastFromLoc() because if 
> it's a region it's a Loc.

The first I tryed was `evalCastFromLoc()`, but it turned out that `SVal` which 
binds to a pointer can be `NonLoc` as well through violation of pointing levels.
Look here:

  void foo(int** p) { // here is a two-level pointer
     *(int*)p = 42; // pretend as a one-level pointer, dereference it and 
assign a number
     *p; // dereferencing once gives a `nonloc::ConcreteInt`
  }
  
  P.S. I can have miscomprehension of this, due to a lack of experience, but 
this is what I observed.

> Shouldn't we do `castRegion()` unconditionally,

I've also tryed and got 10+ tests unpassed. Didn't dig deeper, just refused 
this idea.

> Can we also use `evalCast()` ?

Do you mean to move `castRegion()` to `evalCast()` instead of `dispatchCast()`. 
I can investigate this.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89055/new/

https://reviews.llvm.org/D89055

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to