<html>
    <head>
      <base href="http://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 --- - Crash in static analyzer on template with optional constructor parameter"
   href="http://llvm.org/bugs/show_bug.cgi?id=15832">15832</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash in static analyzer on template with optional constructor parameter
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>bugzilla@jwwalker.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10411" name="attach_10411" title="source (not preprocessed) showing bug">attachment 10411</a> <a href="attachment.cgi?id=10411&action=edit" title="source (not preprocessed) showing bug">[details]</a></span>
source (not preprocessed) showing bug

Overview:  When I run the static analyzer on a certain C++ file, clang crashes
with a bad instruction error.

Steps to reproduce:
Run the analyzer on the attached file.

Actual results:
Crash (bad instruction error), with a log beginning:
Assertion failed: (Val && "isa<> used on a null pointer"), function doit, file
/open-source/llvm/include/llvm/Support/Casting.h, line 97.0

Expect results:

Maybe some analyzer warnings.


Build Date & Platform:

$ /opt/bin/clang --version
clang version 3.3 (trunk 180122) (llvm/trunk 180121)
Target: x86_64-apple-darwin11.4.2
Thread model: posix


Additional Information:

If I change the line defining the variable str1 to str1(NULL), the crash goes
away.


Mac OS crash log:

Process:         clang [49444]
Path:            /opt/bin/clang
Identifier:      clang
Version:         3.3 (???)
Code Type:       X86-64 (Native)
Parent Process:  clang [49443]

Date/Time:       2013-04-23 16:39:39.796 -0700
OS Version:      Mac OS X 10.7.5 (11G63)
Report Version:  9

Interval Since Last Report:          88475 sec
Crashes Since Last Report:           75
Per-App Crashes Since Last Report:   74
Anonymous UUID:                      C6540820-F0A3-4E61-82D4-3424027652A3

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   clang                             0x000000010358a850 0x101d73000 + 25262160
1   clang                             0x000000010358a821 0x101d73000 + 25262113
2   clang                             0x0000000102489ce5 0x101d73000 + 7433445
3   clang                             0x000000010248702f 0x101d73000 + 7421999
4   clang                             0x0000000102491f8f 0x101d73000 + 7466895
5   clang                             0x0000000102492655 0x101d73000 + 7468629
6   clang                             0x00000001024cf37d 0x101d73000 + 7717757
7   clang                             0x00000001024e1a68 0x101d73000 + 7793256
8   clang                             0x00000001024f9596 0x101d73000 + 7890326
9   clang                             0x00000001024e86ba 0x101d73000 + 7820986
10  clang                             0x00000001024d7336 0x101d73000 + 7750454
11  clang                             0x00000001024d6f48 0x101d73000 + 7749448
12  clang                             0x00000001024d6b52 0x101d73000 + 7748434
13  clang                             0x00000001023e8184 0x101d73000 + 6771076
14  clang                             0x00000001023e7925 0x101d73000 + 6768933
15  clang                             0x00000001023e588e 0x101d73000 + 6760590
16  clang                             0x000000010204e774 0x101d73000 + 2996084
17  clang                             0x0000000101dd6957 0x101d73000 + 407895
18  clang                             0x0000000101db282d 0x101d73000 + 260141
19  clang                             0x0000000101d7d1ca 0x101d73000 + 41418
20  clang                             0x0000000101d74370 0x101d73000 + 4976
21  clang                             0x0000000101d7a4e9 0x101d73000 + 29929
22  clang                             0x0000000101d74034 0x101d73000 + 4148

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000103f3aef0  rcx: 0x00007fff8be70e42 
rdx: 0xffffffffffffffff
  rdi: 0x000000000000003c  rsi: 0x0000000000000000  rbp: 0x00007fff6196ebb0 
rsp: 0x00007fff6196ebb0
   r8: 0x0000000000000000   r9: 0x00000000000f4240  r10: 0x0000000000000001 
r11: 0x00007fff73920228
  r12: 0x0000000000000001  r13: 0x00007fdce3c5b7a0  r14: 0x0000000000000000 
r15: 0x00007fdce3c506a8
  rip: 0x000000010358a850  rfl: 0x0000000000010206  cr2: 0x00007fdce3a60008
Logical CPU: 2</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>