NoQ added a comment.

In D108808#2968721 <https://reviews.llvm.org/D108808#2968721>, @whisperity 
wrote:

> What happens for something like the following? Maybe it's also worth a test 
> case?
>
>   bool wait_analogue_pin(volatile int* address, int threshold) {
>     while (*address < threshold) {}
>     return true;
>   }

These checkers dodge these cases by noticing that a loop condition relying on 
pointer-type variables, regardless of volatileness, may potentially alias with 
other things in the program and therefore be mutated at any moment without us 
noticing. The problem with concrete addresses wasn't that the check didn't know 
pointers cause problems, but that there weren't any variables in the expression 
to pay attention to. So I taught this sub-system to recognize these 
non-variables.

Banning pointer defererence operations entirely may still be a nicer solution 
that'd also allow us to simplify some code. I'll take a look.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D108808

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

Reply via email to