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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to