[llvm-bugs] [Bug 45654] New: aligned_alloc with out of range pow2 triggers assert in debug mode

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 23 17:25:44 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45654

            Bug ID: 45654
           Summary: aligned_alloc with out of range pow2 triggers assert
                    in debug mode
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: opt
          Assignee: uday at polymagelabs.com
          Reporter: chang-sun.lin.jr at intel.com
                CC: llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200424/21f84c87/attachment.html>


More information about the llvm-bugs mailing list