[cfe-dev] Clang Static Analyzer and Strict Aliasing

Sam Elliott via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 5 12:15:03 PST 2020


Thanks for the clarification! I'll try to remember that when we get more Static Analyzer issues reported about RISC-V.

Sam

> On 3 Nov 2020, at 1:23 am, Artem Dergachev <noqnoqneo at gmail.com> wrote:
> 
> 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 <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 <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 <mailto:cfe-dev at lists.llvm.org>
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
> 

--
Sam Elliott
Software Team Lead
Senior Software Developer - LLVM and OpenTitan
lowRISC CIC

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


More information about the cfe-dev mailing list