[LLVMbugs] [Bug 17026] New: Assertion failed: (hiBit <= numBits && "hiBit out of range"), function getBitsSet, file include/llvm/ADT/APInt.h, line 496.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 28 11:12:14 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17026

            Bug ID: 17026
           Summary: Assertion failed: (hiBit <= numBits && "hiBit out of
                    range"), function getBitsSet, file
                    include/llvm/ADT/APInt.h, line 496.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11112
  --> http://llvm.org/bugs/attachment.cgi?id=11112&action=edit
Testcase for hiBit out of range assertion

After a report that the xmame port on FreeBSD failed to compile with clang, I
found out this is caused by a clang assertion failure during optimization.  It
reproduces with trunk r189471.

Compiling the attached minimized testcase with -O2 leads to the following
assert (backtrace produced on Linux):

$ ~/llvm/189471-trunk-linux2-x86_64-aconf-rel-1/bin/clang -O2 -c hibit-assert.c
hibit-assert.c:18:12: warning: implicit declaration of function
'ExecuteDataALUOpcode' is invalid in C99
      [-Wimplicit-function-declaration]
    size = ExecuteDataALUOpcode(0);
           ^
hibit-assert.c:41:1: warning: control reaches end of non-void function
[-Wreturn-type]
}
^
clang: /home/dim/src/llvm/trunk/include/llvm/ADT/APInt.h:496: static
llvm::APInt llvm::APInt::getBitsSet(unsigned int, unsigned int, unsigned int):
Assertion `hiBit <= numBits && "hiBit out of range"' failed.
0  clang     0x0000000002232082 llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1  clang     0x000000000223327a
2  libc.so.6 0x00007f9531476920
3  libc.so.6 0x00007f95314768a5 gsignal + 53
4  libc.so.6 0x00007f9531478085 abort + 373
5  libc.so.6 0x00007f953146fa1e
6  libc.so.6 0x00007f953146fae0 __assert_perror_fail + 0
7  clang     0x0000000001ebdbbb
8  clang     0x0000000001ebf69d
9  clang     0x0000000001ec23fa
10 clang     0x0000000001ebf034
11 clang     0x0000000001ec23fa
12 clang     0x0000000001ebebff
13 clang     0x0000000001ec23fa
14 clang     0x0000000001e9e712
15 clang     0x0000000001e6a951
16 clang     0x0000000001e6b76f
17 clang     0x00000000021c92d8
llvm::FPPassManager::runOnFunction(llvm::Function&) + 568
18 clang     0x0000000001f3e9de
19 clang     0x0000000001f3f26d
20 clang     0x00000000021c8d6a llvm::MPPassManager::runOnModule(llvm::Module&)
+ 666
21 clang     0x00000000021c8f97 llvm::PassManagerImpl::run(llvm::Module&) + 247
22 clang     0x000000000083fedc
23 clang     0x0000000000840ac1
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 193
24 clang     0x000000000083d109
25 clang     0x00000000009e645e clang::ParseAST(clang::Sema&, bool, bool) + 382
26 clang     0x000000000083bdde clang::CodeGenAction::ExecuteAction() + 78
27 clang     0x00000000006b52a9 clang::FrontendAction::Execute() + 313
28 clang     0x0000000000691c05
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 341
29 clang     0x00000000006770cd
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1549
30 clang     0x000000000066daa8 cc1_main(char const**, char const**, char
const*, void*) + 1048
31 clang     0x0000000000675493 main + 4467
32 libc.so.6 0x00007f9531462cdd __libc_start_main + 253
33 clang     0x000000000066d4a9
Stack dump:
0.    Program arguments:
/home/dim/llvm/189471-trunk-linux2-x86_64-aconf-rel-1/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name hibit-assert.c
-mrelocation-model static -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -target-linker-version 2.20.51.0.2
-momit-leaf-frame-pointer -coverage-file
/home/dim/src/llvm/bugs/hibit/hibit-assert.o -resource-dir
/home/dim/llvm/189471-trunk-linux2-x86_64-aconf-rel-1/bin/../lib/clang/3.4
-internal-isystem /usr/local/include -internal-isystem
/home/dim/llvm/189471-trunk-linux2-x86_64-aconf-rel-1/bin/../lib/clang/3.4/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdebug-compilation-dir /home/dim/src/llvm/bugs/hibit -ferror-limit 19
-fmessage-length 137 -mstackrealign -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o hibit-assert.o -x c
hibit-assert.c
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'hibit-assert.c'.
4.    Running pass 'Combine redundant instructions' on function '@execute_one'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (trunk 189471)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /home/dim/tmp/hibit-assert-c1eaaa.c
clang: note: diagnostic msg: /home/dim/tmp/hibit-assert-c1eaaa.sh
clang: note: diagnostic msg:

********************

-- 
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/20130828/8f875f60/attachment.html>


More information about the llvm-bugs mailing list