[llvm] 870f691 - Fix "pointer is null" static analyzer warnings. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 27 03:22:40 PDT 2020


Yes it was a clang static analyzer report listed on 
https://llvm.org/reports/scan-build/

I'd include the specific link in the commit message but they don't 
persist very long.

BTW - I keep missing your feedback emails as they get lost in the 
firehose that is llvm-commits - could you use phabricator instead to 
discuss particular commits please?

Cheers, Simon.

On 27/03/2020 01:36, David Blaikie wrote:
> Was this for the Clang Static Analyzer? Any idea what parts the 
> analyzer couldn't understand?
>
> I assume it has to assume that function returns might already be 
> non-null (eg: T1B probably isn't "might be null" & dereferencing it 
> wouldn't be a problem? Or is any pointer return "Maybe null" in which 
> case maybe just asserting T1B and T2B are non-null as soon as they're 
> returned might be more suitable/closer to the source of the divergence?)
>
> On Fri, Jan 10, 2020 at 3:11 AM Simon Pilgrim via llvm-commits 
> <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>
>
>     Author: Simon Pilgrim
>     Date: 2020-01-10T11:10:42Z
>     New Revision: 870f6917936fdb8050be3ca3c67d9259390c4326
>
>     URL:
>     https://github.com/llvm/llvm-project/commit/870f6917936fdb8050be3ca3c67d9259390c4326
>     DIFF:
>     https://github.com/llvm/llvm-project/commit/870f6917936fdb8050be3ca3c67d9259390c4326.diff
>
>     LOG: Fix "pointer is null" static analyzer warnings. NFCI.
>
>     Assert that the pointers are non-null before dereferencing them.
>
>     Added:
>
>
>     Modified:
>         llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
>
>     Removed:
>
>
>
>     ################################################################################
>     diff  --git a/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
>     b/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
>     index b18730d967a3..d0285a7aa377 100644
>     --- a/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
>     +++ b/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
>     @@ -282,6 +282,7 @@ bool
>     HexagonEarlyIfConversion::matchFlowPattern(MachineBasicBlock *B,
>        // can fall through into the other, in other words, it will be
>     executed
>        // in both cases. We only want to predicate the block that is
>     executed
>        // conditionally.
>     +  assert(TB && FB && "Failed to find triangle control flow blocks");
>        unsigned TNP = TB->pred_size(), FNP = FB->pred_size();
>        unsigned TNS = TB->succ_size(), FNS = FB->succ_size();
>
>
>
>
>     _______________________________________________
>     llvm-commits mailing list
>     llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>     https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200327/4fc92d0f/attachment.html>


More information about the llvm-commits mailing list