<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 --- - Integer not passed correctly in vararg"
   href="http://llvm.org/bugs/show_bug.cgi?id=18727">18727</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Integer not passed correctly in vararg
          </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>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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ishiura-compiler@ml.kwansei.ac.jp
          </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>Clang 3.5 (based on LLVM 3.5svn) for x86_64 target miscompiles the following
code.

    $ cat error.c

    #include <stdarg.h>

    union U0 { long m0[2]; };
    union U1 { int m0; };
    struct S0 { int m0[5]; };

    struct S0 func(struct S0 x0, ... )
    {
        va_list ap;
        va_start(ap, x0);
        union U0 x1 = va_arg(ap, union U0);
        union U0 x2 = va_arg(ap, union U0);
        union U1 x3 = va_arg(ap, union U1);
        int x4 = va_arg(ap, int);
        va_end(ap);

        if( x4 != 1 ) { __builtin_abort(); }

        return x0;
    }

    int main(void)
    {
        struct S0 x0 = {{1,1,1,1,1}};
        union U0 x1 = {{1,1}};
        union U1 x2 = {1};
        func(x0, x1, x1, x2, x0.m0[0]);

        return 0;
    }

    $ clang error.c

    $ ./a.out
    Abort trap: 6

The value of x4 was 0 instead of 1.
There was no problem with an i686 target.

    $ clang -v
    clang version 3.5 (trunk 200763)
    Target: x86_64-apple-darwin13.0.0
    Thread model: posix</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>