<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 --- - Assertion failure in ResolveCondition with cfg-temporary-dtors=true"
   href="http://llvm.org/bugs/show_bug.cgi?id=18227">18227</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure in ResolveCondition with cfg-temporary-dtors=true
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>dconnelly@google.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=11715" name="attach_11715" title="Stack trace">attachment 11715</a> <a href="attachment.cgi?id=11715&action=edit" title="Stack trace">[details]</a></span>
Stack trace

Testing against r197139 on both Linux and Mac. As noted in the summary, the
assertion only fails with cfg-temporary-dtors=true.

A small crashing input is below. I can only reproduce the crash under the
following restrictions on the input:

- The condition of the ternary operator must have the form "(x R y) S (z T w)"
for any x,y,z,w of any type, but R,S,T must each be '&&' or '||'. It is not
required that R,S,T all be the same.
- A().a() can be either the if-value or the else-value or both of the ternary
operator. All three crash.
- The A::a member function must be called on the temporary A instance; A()
alone doesn't crash.
- The destructor A::~A must be explicitly defined. Using the auto-generated
destructor won't crash.

===============================================
Preprocessed source
===============================================

# 1 "<built-in>" 1
# 1 "main.cc" 1
struct A {
  ~A() {}
  void a() {}
};

int main() {
  (false && false) && (false && false) ? (void)0 : A().a();
}

===============================================
Invocation
===============================================

clang++ --analyze -Xclang -analyzer-config -Xclang cfg-temporary-dtors=true
main.cc

===============================================
Dumped invocation
===============================================

"/media/gallia/analyzer/build/Debug+Asserts/bin/clang" -cc1 -triple
x86_64-unknown-linux-gnu -analyze -disable-free -main-file-name main.cc
-analyzer-store=region -analyzer-opt-analyze-nested-blocks
-analyzer-eagerly-assume -analyzer-checker=core -analyzer-checker=unix
-analyzer-checker=deadcode -analyzer-checker=cplusplus
-analyzer-checker=security.insecureAPI.UncheckedReturn
-analyzer-checker=security.insecureAPI.getpw
-analyzer-checker=security.insecureAPI.gets
-analyzer-checker=security.insecureAPI.mktemp
-analyzer-checker=security.insecureAPI.mkstemp
-analyzer-checker=security.insecureAPI.vfork -analyzer-output plist -w
-mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.22 -fdeprecated-macro -ferror-limit 19 -fmessage-length 318 -mstackrealign
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-slp -analyzer-config cfg-temporary-dtors=true -x
c++ main-77ac9d.cpp

===============================================
Stack trace
===============================================

Attached.</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>