<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:΢ÈíÑźÚ
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi!<br><br><br>The code sample as below:<br><br>-------------main.cpp----------------<br><br><blockquote>int* func(int b)<br>{<br>    if (b > 0)<br>    {        <br>        return new int[3];<br>    }<br>    return 0;<br>}<br><br>void np_1(int* p, int b)<br>{<br>    p = func(b);<br>    *p = 123;<br>    return;<br>}<br><br></blockquote>---------------------------------------<br><br>The command I ran: "<b>clang -cc1 -analyze -analyzer-checker=core.NullDereference main.cpp</b>".<br>In my opinion,there should report a null pointer dereference error at code "*p = 123", since "func" would return 0 if b is not greater than zero.<br>Howerver, no error reported. I debugged clang and found that "CheckerContext::emitReport()" indeed has been invoked when derefencing pointer p. <br><br>clang version:<br>clang version 3.8.0 (trunk 248698)<br>Target: x86_64-apple-darwin15.0.0<br>Thread model: posix<br><br>Can somebody tell me where the problem is? <br>Thanks in advance, Quark<br><br>                                         </div></body>
</html>