<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 - aligned_alloc with out of range pow2 triggers assert in debug mode"
   href="https://bugs.llvm.org/show_bug.cgi?id=45654">45654</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>aligned_alloc with out of range pow2 triggers assert in debug mode
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>opt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>uday@polymagelabs.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chang-sun.lin.jr@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>After D76971, this test case triggers an assert in a clang debug build:

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>

int main() {
  void *p, *q;

  errno = 0;
  p = (int *)aligned_alloc(0x8000000000000000,0x8000000000000000);
  printf("%p %d\n", p, errno);
  return 0;
}


clang -O3 maxalign.c

clang-11:
/export/iusers2/clin1/workspaces/llorg/llvm/llvm/lib/IR/Attributes.cpp:147:
static llvm::Attribute llvm::Attribute::getWithAlignment(llvm::LLVMContext&,
llvm::Align): Assertion `A <= llvm::Value::MaximumAlignment && "Alignment too
large."' failed.

It looks like the InstCombineCalls code in D76971 might need to check for
MaximumAlignment before generating the attribute.</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>