Clang Static Analyzer and Strict Aliasing

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Clang Static Analyzer and Strict Aliasing

Manas via cfe-dev
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).


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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang Static Analyzer and Strict Aliasing

Manas via cfe-dev
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).


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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang Static Analyzer and Strict Aliasing

Manas via cfe-dev
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 <[hidden email]> 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, 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).


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
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


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


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev