<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 --- - Code in the false branch of an &quot;if&quot; is executed" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23707&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=XrSPhVH6QWzxQ1iaz1KYMVTztaMfX_ceVzYEOv1wfFg&s=jrT9MYD40pE4_A2QFeLzSUKJqg8J-vpYM4eKJ_S2mto&e=">23707</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Code in the false branch of an "if" is executed
          </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>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>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>paumard@users.sourceforge.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, 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=14405" name="attach_14405" title="test case">attachment 14405</a> <a href="attachment.cgi?id=14405&action=edit" title="test case">[details]</a></span>
test case

Hi,

I downloaded llvm and clang today from svn trunk. I built it on Debian Jessie
(libc++ from GCC 4.9 provided by Debian).

When I build the attached code with -O1 or -O2 and then execute it, the code
fails with SIGFPE. The division by 0 is in the false branch of an "if", so this
code should not be executed.

The example is minimal: removing cerr output or uncommenting either of the
commented-out lines results in correct behaviour.

The issue is not present when compiling with -O0, with clang++-3.4 or 3.5, or
with g++.

The bug has been reported as a Debian bug first but is present in trunk:
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__bugs.debian.org_787217&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=XrSPhVH6QWzxQ1iaz1KYMVTztaMfX_ceVzYEOv1wfFg&s=ave7L6JAXlc3SO3RYxiIo7AnsHF8yRfE1z3p9sWd2GQ&e=">http://bugs.debian.org/787217</a>

Kind regards, Thibaut.</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>