[cfe-dev] Clang Static Analyzer and Strict Aliasing

Artem Dergachev via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 2 17:23:52 PST 2020


Hi,

No, it shouldn't reason or warn about strict aliasing. It potentially 
could and i'd love it to, but as of now it doesn't. When it does, like 
in https://bugs.llvm.org/show_bug.cgi?id=47727, it's a bug in the static 
analyzer, namely yet another instance of 
https://bugs.llvm.org/show_bug.cgi?id=44114. In particular, if you 
change one of the types to char (or something like that), it'll bypass 
the strict aliasing rule and the analyzer would still emit a warning 
which would then be a definite false positive. I'll reply to that bug 
report.

On 10/28/20 2:31 AM, Sam Elliott via cfe-dev wrote:
> Hi Cfe-dev,
>
> I'm not particularly familiar with the clang static analzyer, so would 
> like some help with a bug that was filed against it (when compiling 
> for RISC-V, but I don't think that's the issue here, as the bug also 
> shows up with the default target).
>
> The bug is here: https://bugs.llvm.org/show_bug.cgi?id=47727 
> <https://bugs.llvm.org/show_bug.cgi?id=47727>
>
> Is it expected that the static analzyer will catch (some?) strict 
> aliasing issues like this?
>
> Sam
>
> --
> Sam Elliott
> Software Team Lead
> Senior Software Developer - LLVM and OpenTitan
> lowRISC CIC
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201102/a4ed7550/attachment.html>


More information about the cfe-dev mailing list