<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 --- - -03 Optimization causes function to execute twice" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24158&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=kXG6GzX4Gbtt4H5I7IcH-J7kRWd2Qb-YkFGkqB0cxxI&s=ZK5jeRZJnQj9ZX3275Q6yq3VTgHOgSDr63O3pnPqa6k&e=">24158</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-03 Optimization causes function to execute twice
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>hbowden@securelabsllc.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>I started writing a new C project and I noticed that a function was executing
twice even though It's only being called once. While trying to figure out what
was going on I removed, -O3 from the Makefile and built and ran the program and
saw that the function was no longer being called twice.

To reproduce the problem pull the repository below, don't worry there's barely
any code, it's a new project.

<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Secure-2DLabs_nextgen.git&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=kXG6GzX4Gbtt4H5I7IcH-J7kRWd2Qb-YkFGkqB0cxxI&s=cyJlhjbnMDGvA573u4RdvRsrOtq0EJdWgmwucSvp1GI&e=">https://github.com/Secure-Labs/nextgen.git</a>

Then use gmake to build the project, I put the -O3 back in the Makefile, and
I'm using clang 3.6.1 on FreeBSD 10.1 Release.

To run the program use sudo ./nextgen --file --in / --out / --exec /usr/bin/ls

The function that's being called twice is start_runtime which is in the file
runtime.c and starts on line 90. start_runtime is called from nextgen.c in
main.

Remove -03 from the makefile and start_runtime is only executed once.</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>