<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - scan-build did not found error on simple program with assert()"
   href="https://llvm.org/bugs/show_bug.cgi?id=30679">30679</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>scan-build did not found error on simple program with assert()
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>socketpair@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>#include <stdio.h>
#include <assert.h>

static void show(const char *const msg)
{
    assert(msg != NULL);
    printf("msg=%s\n", msg);
}

int main(void)
{
    show("qwe");
    show(NULL);
    show("asd");
    return 0;
}

==================================

scan-build finds no error in this code. But finds other errors (like possibly
memory leakage when I explicitly add such error in the code.

=============

scan-build-3.8 gcc qwe.c
scan-build: Using '/usr/lib/llvm-3.8/bin/clang' for static analysis
scan-build: Removing directory '/tmp/scan-build-2016-10-13-000037-5639-1'
because it contains no reports.
scan-build: No bugs found.

=============

qwe.i: (no difference  on gcc and clang except whitespaces)

...

(!)!!!!!! note __noreturn__ and <a href="http://clang-analyzer.llvm.org/annotations.html">http://clang-analyzer.llvm.org/annotations.html</a>
!!!!!

# 69 "/usr/include/assert.h" 3 4
extern void __assert_fail (const char *__assertion, const char *__file,
      unsigned int __line, const char *__function)
     __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));

...

static void show(const char *const msg)
{
   ((msg != ((void *)0)) ? (void) (0) : __assert_fail ("msg != NULL", "qwe.c",
7, __PRETTY_FUNCTION__))

    printf("msg=%s\n", msg);
}

...

=================</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>