[llvm-bugs] [Bug 43638] New: builtin_assume_aligned uses 32-bits for alignment

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 10 08:51:48 PDT 2019


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

            Bug ID: 43638
           Summary: builtin_assume_aligned uses 32-bits for alignment
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: joel.gouly at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

This test cases crashes clang, because 'unsigned' is used for the alignment,
rather than 'size_t'.

    const void * square(const void* num) {
      void* a = __builtin_assume_aligned((const void*)num, 4294967296);
      return a;
    }

Assertion:

llvm/llvm/include/llvm/IR/IRBuilder.h:2624: llvm::CallInst* llvm::IRBuilder<T,
Inserter>::CreateAlignmentAssumption(const llvm::DataLayout&, llvm::Value*,
unsigned int, llvm::Value*, llvm::Value**) [with T = llvm::ConstantFolder;
Inserter = clang::CodeGen::CGBuilderInserter]: Assertion `Alignment != 0 &&
"Invalid Alignment"' failed.

The affected functions are `EmitAlignmentAssumption` in
lib/CodeGen/CodeGenFunction.h and also `CreateAlignmentAssumption` in
include/llvm/IR/IRBuilder.h

-- 
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/20191010/8f22f17f/attachment-0001.html>


More information about the llvm-bugs mailing list