[llvm-dev] Change in -Wnonnull in gcc-11

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 1 12:47:16 PDT 2021


Sure, those things seem legit - I think we have some sanitizer mode (& some
optimizations, when the sanitizer checks aren't enabled) for checking
non-null-ness in various cases, which probably would hit these cases
(though given that I think various sanitizer self host builds are checked
regularly, I wonder if there's an interesting explanation for why the cases
in [6] were not found already by runtime analysis like that) - probably
makes sense to catch them at compile time where we can. Though clang's
warnings aren't interprocedural like it looks like some of these warnings
in [6] are, so clang might still not catch all of them.

On Wed, Sep 1, 2021 at 11:44 AM Luke Benes via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

>
>
> In gcc-11, -Wnonnull considers the implicit this argument of every C++
> nonstatic member function to have been implicitly declared with attribute
> nonnull and triggers warnings for calls where the pointer is null. [1]
>
> Should clang also do this? This change helped webkit identify and fix some
> issues. [2][3][4][5]
>
> Building clang trunk with gcc-11 produces 13 new warnings related to this
> enhancement. They are in MachineModuleInfo.cpp and RangeAdapterTest.cpp.[6]
> Do these look like valid issues?
>
> -Luke
>
>
> [1] https://gcc.gnu.org/gcc-11/changes.html\
> [2] https://bugs.webkit.org/show_bug.cgi?id=224838
> [3] https://bugs.webkit.org/show_bug.cgi?id=224826
> [4] https://trac.webkit.org/changeset/276343/webkit
> [5] https://bugs.webkit.org/show_bug.cgi?id=224452
> [6] https://pastebin.com/EJTZphGm
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210901/7419b605/attachment.html>


More information about the llvm-dev mailing list