[llvm-bugs] [Bug 33844] New: Assertion `loBit <= BitWidth && "loBit out of range"' failed with -O1

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 18 15:55:43 PDT 2017


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

            Bug ID: 33844
           Summary: Assertion `loBit <= BitWidth && "loBit out of range"'
                    failed with -O1
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: babokin at gmail.com
                CC: llvm-bugs at lists.llvm.org

clang trunk, rev308350, x86_64

> cat f.cpp
int a;
long b;
struct {
  char c : 29;
} d;
void e() {
  d.c = ~0 + 483647 & (a < 0) + 2147483647 >> (b << ~0 + 24) + 8388639;
}

> clang++ -O1 -o f.o -c f.cpp -w
clang-5.0:
/home/dybaboki/llvm/llvm-trunk-20170718/include/llvm/ADT/APInt.h:1399: void
llvm::APInt::setBits(unsigned int, unsigned int): Assertion `loBit <= BitWidth
&& "loBit out of range"' failed.
#0 0x00000000013170df llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x13170df)
#1 0x00000000013173e6 SignalHandler(int)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x13173e6)
#2 0x00007f27d8cbb370 __restore_rt (/lib64/libpthread.so.0+0xf370)
#3 0x00007f27d78b31d7 __GI_raise (/lib64/libc.so.6+0x351d7)
#4 0x00007f27d78b48c8 __GI_abort (/lib64/libc.so.6+0x368c8)
#5 0x00007f27d78ac146 __assert_fail_base (/lib64/libc.so.6+0x2e146)
#6 0x00007f27d78ac1f2 (/lib64/libc.so.6+0x2e1f2)
#7 0x00000000007e0478 llvm::APInt::setBits(unsigned int, unsigned int)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x7e0478)
#8 0x00000000008291e7 foldMaskAndShiftToScale(llvm::SelectionDAG&,
llvm::SDValue, unsigned long, llvm::SDValue, llvm::SDValue, (anonymous
namespace)::X86ISelAddressMode&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x8291e7)
#9 0x00000000008284ef (anonymous
namespace)::X86DAGToDAGISel::matchAddressRecursively(llvm::SDValue, (anonymous
namespace)::X86ISelAddressMode&, unsigned int)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x8284ef)
#10 0x00000000008299f9 (anonymous
namespace)::X86DAGToDAGISel::matchAdd(llvm::SDValue, (anonymous
namespace)::X86ISelAddressMode&, unsigned int)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x8299f9)
#11 0x00000000008278cd (anonymous
namespace)::X86DAGToDAGISel::matchAddressRecursively(llvm::SDValue, (anonymous
namespace)::X86ISelAddressMode&, unsigned int)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x8278cd)
#12 0x0000000000825c13 (anonymous
namespace)::X86DAGToDAGISel::matchAddress(llvm::SDValue, (anonymous
namespace)::X86ISelAddressMode&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x825c13)
#13 0x000000000082a59f (anonymous
namespace)::X86DAGToDAGISel::selectLEAAddr(llvm::SDValue, llvm::SDValue&,
llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x82a59f)
#14 0x00000000008242c8 (anonymous
namespace)::X86DAGToDAGISel::CheckComplexPattern(llvm::SDNode*, llvm::SDNode*,
llvm::SDValue, unsigned int, llvm::SmallVectorImpl<std::pair<llvm::SDValue,
llvm::SDNode*> >&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x8242c8)
#15 0x0000000001a5023f llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*,
unsigned char const*, unsigned int)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x1a5023f)
#16 0x000000000081f196 (anonymous
namespace)::X86DAGToDAGISel::Select(llvm::SDNode*)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x81f196)
#17 0x0000000001a497da llvm::SelectionDAGISel::DoInstructionSelection()
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x1a497da)
#18 0x0000000001a487f2 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x1a487f2)
#19 0x0000000001a45fa3
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x1a45fa3)
#20 0x0000000001a42b56
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x1a42b56)
#21 0x000000000081af81 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x81af81)
#22 0x0000000000bd4f64
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0xbd4f64)
#23 0x0000000000ecfb1f llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0xecfb1f)
#24 0x0000000000ecfd73 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0xecfd73)
#25 0x0000000000ed0266 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0xed0266)
#26 0x0000000001487c2f 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/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x1487c2f)
#27 0x0000000001b31162
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x1b31162)
#28 0x0000000001f96806 clang::ParseAST(clang::Sema&, bool, bool)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x1f96806)
#29 0x00000000018093d8 clang::FrontendAction::Execute()
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x18093d8)
#30 0x00000000017cdd31
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x17cdd31)
#31 0x000000000188e797
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x188e797)
#32 0x000000000077174f cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x77174f)
#33 0x000000000076f4d6 main
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x76f4d6)
#34 0x00007f27d789fb35 __libc_start_main (/lib64/libc.so.6+0x21b35)
#35 0x000000000076c817 _start
(/home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0+0x76c817)
Stack dump:
0.      Program arguments: /home/dybaboki/llvm/bin-trunk-20170718/bin/clang-5.0
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
f.cpp -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb
-coverage-notes-file
/home/dybaboki/yarpgen/yarpgen/test_run_july17_creduce/result/clang/compfail/S_1729113319/f.gcno
-resource-dir /home/dybaboki/llvm/bin-trunk-20170718/lib/clang/5.0.0
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward
-internal-isystem /usr/local/include -internal-isystem
/home/dybaboki/llvm/bin-trunk-20170718/lib/clang/5.0.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O1
-w -fdeprecated-macro -fdebug-compilation-dir
/home/dybaboki/yarpgen/yarpgen/test_run_july17_creduce/result/clang/compfail/S_1729113319
-ferror-limit 19 -fmessage-length 272 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o f.o -x c++ f.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'f.cpp'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@_Z1ev'
clang-5.0: error: unable to execute command: Aborted
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 308350)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/dybaboki/llvm/bin-trunk-20170718/bin
clang-5.0: 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-5.0: 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/20170718/f88a7ec5/attachment-0001.html>


More information about the llvm-bugs mailing list