[llvm-bugs] [Bug 49830] New: LLVM 12 regression: aarch64 APInt.h:1634: uint64_t llvm::APInt::getZExtValue() const: Assertion `getActiveBits() <= 64 && "Too many bits for uint64_t"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 3 20:20:33 PDT 2021


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

            Bug ID: 49830
           Summary: LLVM 12 regression: aarch64 APInt.h:1634: uint64_t
                    llvm::APInt::getZExtValue() const: Assertion
                    `getActiveBits() <= 64 && "Too many bits for
                    uint64_t"' failed
           Product: new-bugs
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: andrew at ziglang.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

This is a regression from LLVM 11. 
Downstream issue: https://github.com/ziglang/zig/issues/8429

Reduced LLVM IR:

; ModuleID = 'test.ll'
source_filename = "test"
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux-musl"

define internal fastcc i64 @time.milliTimestamp() unnamed_addr {
DivZeroOk:
  %0 = icmp eq i128 undef, -170141183460469231731687303715884105728
  %1 = and i1 %0, false
  br i1 %1, label %DivOverflowFail, label %DivOverflowOk

DivOverflowFail:                                  ; preds = %DivZeroOk
  unreachable

DivOverflowOk:                                    ; preds = %DivZeroOk
  ret i64 undef
}

How to reproduce:

[nix-shell:~/dev/zig/build-llvm12]$ ~/local/llvm12-debug/bin/clang-12 -o test
test.ll  -nostartfiles -nodefaultlibs -target aarch64-unknown-linux-unknown 
-fuse-ld=$HOME/local/llvm12-release/bin/ld.lld -static 
warning: overriding the module target triple with aarch64-unknown-linux-unknown
[-Woverride-module]
clang-12: ../include/llvm/ADT/APInt.h:1634: uint64_t
llvm::APInt::getZExtValue() const: Assertion `getActiveBits() <= 64 && "Too
many bits for uint64_t"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/andy/local/llvm12-debug/bin/clang-12 -cc1
-triple aarch64-unknown-linux-unknown -emit-obj -mrelax-all
--mrelax-relocations -disable-free -main-file-name test.ll -static-define
-mrelocation-model static -mframe-pointer=non-leaf -fmath-errno
-fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu generic
-target-feature +neon -target-abi aapcs -fallow-half-arguments-and-returns
-fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/home/andy/local/llvm12-debug/lib/clang/12.0.0 -fdebug-compilation-dir
/home/andy/dev/zig/build-llvm12 -ferror-limit 19 -fno-signed-char
-fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -o
/run/user/1000/test-b5487f.o -x ir test.ll
1.      Code generation
2.      Running pass 'Function Pass Manager' on module 'test.ll'.
3.      Running pass 'IRTranslator' on function '@time.milliTimestamp'
 #0 0x0000000004ac59b9 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/Support/Unix/Signals.inc:565:22
 #1 0x0000000004ac5a70 PrintStackTraceSignalHandler(void*)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/Support/Unix/Signals.inc:632:1
 #2 0x0000000004ac3a56 llvm::sys::RunSignalHandlers()
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/Support/Signals.cpp:71:20
 #3 0x0000000004ac5400 SignalHandler(int)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/Support/Unix/Signals.inc:407:1
 #4 0x00007f81e132aee0 __restore_rt
(/nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libpthread.so.0+0x12ee0)
 #5 0x00007f81e0e2708a raise
(/nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libc.so.6+0x3808a)
 #6 0x00007f81e0e11528 abort
(/nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libc.so.6+0x22528)
 #7 0x00007f81e0e1140f _nl_load_domain.cold.0
(/nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libc.so.6+0x2240f)
 #8 0x00007f81e0e1fa02
(/nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libc.so.6+0x30a02)
 #9 0x0000000001d7f881 llvm::APInt::getZExtValue() const
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../include/llvm/ADT/APInt.h:1634:5
#10 0x0000000001d81f76 llvm::ConstantInt::getZExtValue() const
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../include/llvm/IR/Constants.h:146:3
#11 0x000000000569fc13
llvm::IRTranslator::emitSwitchCase(llvm::SwitchCG::CaseBlock&,
llvm::MachineBasicBlock*, llvm::MachineIRBuilder&)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/CodeGen/GlobalISel/IRTranslator.cpp:843:12
#12 0x000000000569e8a1 llvm::IRTranslator::translateBr(llvm::User const&,
llvm::MachineIRBuilder&)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/CodeGen/GlobalISel/IRTranslator.cpp:632:11
#13 0x00000000056ab336 llvm::IRTranslator::translate(llvm::Instruction const&)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../include/llvm/IR/Instruction.def:128:1
#14 0x00000000056aeb54
llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/CodeGen/GlobalISel/IRTranslator.cpp:3183:9
#15 0x0000000003a998cc
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/CodeGen/MachineFunctionPass.cpp:72:33
#16 0x00000000040410b9 llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/IR/LegacyPassManager.cpp:1435:20
#17 0x0000000004041324 llvm::FPPassManager::runOnModule(llvm::Module&)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/IR/LegacyPassManager.cpp:1481:13
#18 0x000000000404174e (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/IR/LegacyPassManager.cpp:1550:20
#19 0x000000000403cede llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/IR/LegacyPassManager.cpp:541:13
#20 0x0000000004041f37 llvm::legacy::PassManager::run(llvm::Module&)
/home/andy/Downloads/llvm-project-12/llvm/build-debug/../lib/IR/LegacyPassManager.cpp:1678:1
#21 0x0000000004dc26ec clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/andy/local/llvm12-debug/bin/clang-12+0x4dc26ec)
#22 0x0000000005bdede1 clang::CodeGenAction::ExecuteAction()
(/home/andy/local/llvm12-debug/bin/clang-12+0x5bdede1)
#23 0x000000000541f849 clang::FrontendAction::Execute()
(/home/andy/local/llvm12-debug/bin/clang-12+0x541f849)
#24 0x00000000053c152e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/andy/local/llvm12-debug/bin/clang-12+0x53c152e)
#25 0x00000000054f1640
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/andy/local/llvm12-debug/bin/clang-12+0x54f1640)
#26 0x0000000001d59184 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/andy/local/llvm12-debug/bin/clang-12+0x1d59184)
#27 0x0000000001d55998 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/andy/local/llvm12-debug/bin/clang-12+0x1d55998)
#28 0x0000000001d46df6 main
(/home/andy/local/llvm12-debug/bin/clang-12+0x1d46df6)
#29 0x00007f81e0e12c7d __libc_start_main
(/nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libc.so.6+0x23c7d)
#30 0x0000000001d5552a _start
/build/glibc-2.31/csu/../sysdeps/x86_64/start.S:122:0
clang-12: error: unable to execute command: Aborted (core dumped)
clang-12: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 12.0.0 (https://github.com/llvm/llvm-project
31001be371e8f2c74470e727e54503fb2aabec8b)
Target: aarch64-unknown-linux-unknown
Thread model: posix
InstalledDir: /home/andy/local/llvm12-debug/bin
clang-12: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

-- 
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/20210404/3d82ba70/attachment-0001.html>


More information about the llvm-bugs mailing list