<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Crash on win64 vectorcall with large"
   href="https://bugs.llvm.org/show_bug.cgi?id=48248">48248</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash on win64 vectorcall with large
          </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>Windows XP
          </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>christoffer.lerno@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I found a possible bug in TargetInfo.cpp, WinX86_64ABIInfo::classify

On rows 4215-4216 we have the following:

 } else if (IsReturnType) {
   return ABIArgInfo::getExpand();

This would suggest that we use "Expand" as strategy for a return value on a
vector call. However, "Expand" is not a valid strategy for return values, as it
is only for parameters. Hoping to expose this bug, I created large vectors
embedded in structs, which would then hit the "homogenous aggregate" path in
said function.

I finally struck gold with the following:

typedef double foo __attribute__ ((vector_size (64)));
struct Test {
    foo a[2];
};

struct Test __vectorcall bar(struct Test a) {
    return (struct Test) {};
}

However I am not sure that I'm actually triggering the bug, or if there are
multiple bugs, as this only crashes when "struct Test a" is there, which makes
me suspect that maybe we're hitting some other bug here.

Godbolt link: <a href="https://www.godbolt.org/z/EWWaor">https://www.godbolt.org/z/EWWaor</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>