NagyDonat wrote:

> These results look correct according to the checker, but I am not sure if 
> such results are useful or really invalid: 
> https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=vim_v8.2.1920_pointersub1&is-unique=on&diff-type=New&checker-name=alpha.core.PointerSub
>  In these cases the address difference of an (array) member of a struct and 
> start of the struct is taken. According to the checker rules, taking 
> difference of addresses of any variables or member variables is invalid.

This trickery basically reimplements `offsetof()` (or something very similar to 
it), and as it is in the stable `vim` repo I assume that it's accepted by 
practically all compilers; but it clearly violates the language standard so I 
think it's good that the checker reports it. (Perhaps this trick would've been 
acceptable thirty years ago, but now we have standard `offsetof()` that usually 
expands to `__builtin_offsetof()` so developers who try to use homemade 
alternatives deserve a warning.) 

https://github.com/llvm/llvm-project/pull/96501
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to