<div dir="ltr">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.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 1, 2021 at 11:44 AM Luke Benes via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br>
<br>
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] <br>
<br>
Should clang also do this? This change helped webkit identify and fix some issues. [2][3][4][5] <br>
<br>
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? <br>
<br>
-Luke<br>
<br>
<br>
[1] <a href="https://gcc.gnu.org/gcc-11/changes.html%5C" rel="noreferrer" target="_blank">https://gcc.gnu.org/gcc-11/changes.html\</a><br>
[2] <a href="https://bugs.webkit.org/show_bug.cgi?id=224838" rel="noreferrer" target="_blank">https://bugs.webkit.org/show_bug.cgi?id=224838</a><br>
[3] <a href="https://bugs.webkit.org/show_bug.cgi?id=224826" rel="noreferrer" target="_blank">https://bugs.webkit.org/show_bug.cgi?id=224826</a><br>
[4] <a href="https://trac.webkit.org/changeset/276343/webkit" rel="noreferrer" target="_blank">https://trac.webkit.org/changeset/276343/webkit</a><br>
[5] <a href="https://bugs.webkit.org/show_bug.cgi?id=224452" rel="noreferrer" target="_blank">https://bugs.webkit.org/show_bug.cgi?id=224452</a><br>
[6] <a href="https://pastebin.com/EJTZphGm" rel="noreferrer" target="_blank">https://pastebin.com/EJTZphGm</a><br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>