<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 --- - wrong code at -O1 and higher, variadic function"
   href="http://llvm.org/bugs/show_bug.cgi?id=17311">17311</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wrong code at -O1 and higher, variadic function
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jed@59a2.org
          </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=11253" name="attach_11253" title="test case">attachment 11253</a> <a href="attachment.cgi?id=11253&action=edit" title="test case">[details]</a></span>
test case

Attached is a test case that I have reduced after noticing in the error
handling code of one of my projects.  It is only present with clang at -O1 and
higher.

$ make a.out && ./a.out
clang -Wall -Wextra -pedantic -std=c99 -O1 -g     -c -o a.o a.c
clang -Wall -Wextra -pedantic -std=c99 -O1 -g     -c -o xrank.o xrank.c
clang -o a.out a.o xrank.o
main() line 47 in /dir/NOT THE FILE NAME

At any lower optimization level, or with gcc, this program prints the expected
output:

main() line 47 in /dir/a.c

I'm running Archlinux from today (2013-09-20),

clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Linux batura 3.11.1-1-ARCH #1 SMP PREEMPT Sat Sep 14 19:30:21 CEST 2013 x86_64
GNU/Linux

Test case also available at:

<a href="https://gist.github.com/jedbrown/6646889">https://gist.github.com/jedbrown/6646889</a></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>