NoQ added a subscriber: NoQ.
NoQ added a comment.

In http://reviews.llvm.org/D13126#291763, @danielmarjamaki wrote:

> I have problems with the "default" handling of expressions.
>
> I want to warn about loss of precision for such code:
>
>   unsigned int x = 256;
>   unsigned char c;
>   c = x;
>   
>
> The analyser tells me that the RHS value is 0 instead of 256 in the 
> assignment "c = x". Here is the dump of the ProgramState:
>
> Store (direct and default bindings), 0x0 :
>
> Expressions:
>  (0x7b9bd30,0x7b458d8) c : &c
>  (0x7b9bd30,0x7b45940) x : 0 U8b
>  Ranges are empty.


Hmm. I guess you need to sign up for the cast expression rather than for the 
binary operator expression. By the time you reach the assignment operator, the 
value before the cast is already removed from the environment.


http://reviews.llvm.org/D13126



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

Reply via email to