[llvm-bugs] [Bug 30813] New: Assertion `ShiftBits != 0 && MaskBits <= Size' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 27 12:23:01 PDT 2016


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

            Bug ID: 30813
           Summary: Assertion `ShiftBits != 0 && MaskBits <= Size' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Vsevolod.Livinskij at frtk.ru
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17502
  --> https://llvm.org/bugs/attachment.cgi?id=17502&action=edit
Reproducer.

Assertion `ShiftBits != 0 && MaskBits <= Size' failed. Everything works fine
with -O1 and above.

Reproducer:
short a, b;
struct d {
  int c : 1017;
};
struct f {
  d e;
};
struct {
  f g;
} h;
int i;
void j() {
  long k = unsigned((unsigned long)5 >>
                    (i & long(405769815438914582 < (b >= 0)) / 1));
  h.g.e.c = a;
}


LLVM version:
clang version 4.0.0 (trunk 284990)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/vlivinsk/workspace/llvm/bin-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

Error:
>$ clang++ -O0 small.cpp
clang-4.0:
/home/vlivinsk/workspace/llvm/llvm-trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:3064:
llvm::SDValue {anonymous}::DAGCombiner::visitANDLike(llvm::SDValue,
llvm::SDValue, llvm::SDNode*): Assertion `ShiftBits != 0 && MaskBits <= Size'
failed.
#0 0x00000000014298b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x14298b8)
#1 0x000000000142750e llvm::sys::RunSignalHandlers()
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x142750e)
#2 0x0000000001427682 SignalHandler(int)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1427682)
#3 0x00007f9d37ea93d0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x113d0)
#4 0x00007f9d3705f418 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35418)
#5 0x00007f9d3706101a abort (/lib/x86_64-linux-gnu/libc.so.6+0x3701a)
#6 0x00007f9d37057bd7 (/lib/x86_64-linux-gnu/libc.so.6+0x2dbd7)
#7 0x00007f9d37057c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x0000000000786148 (anonymous
namespace)::DAGCombiner::visitANDLike(llvm::SDValue, llvm::SDValue,
llvm::SDNode*) [clone .isra.512]
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x786148)
#9 0x0000000001a57249 (anonymous
namespace)::DAGCombiner::visitAND(llvm::SDNode*)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1a57249)
#10 0x0000000001a5d83f (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1a5d83f)
#11 0x0000000001a5e99f (anonymous
namespace)::DAGCombiner::combine(llvm::SDNode*)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1a5e99f)
#12 0x0000000001a607df llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults&, llvm::CodeGenOpt::Level)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1a607df)
#13 0x0000000001b13b58 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1b13b58)
#14 0x0000000001b1e2dc
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1b1e2dc)
#15 0x0000000001b204f9
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) [clone
.part.722] [clone .constprop.746]
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1b204f9)
#16 0x00000000009e9d04 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x9e9d04)
#17 0x0000000000d37955
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0xd37955)
#18 0x000000000103f803 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x103f803)
#19 0x000000000103f8cc llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x103f8cc)
#20 0x000000000103f36d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x103f36d)
#21 0x00000000015b34e8 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
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/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x15b34e8)
#22 0x0000000001be2623
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1be2623)
#23 0x0000000001fc4f38 clang::ParseAST(clang::Sema&, bool, bool)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1fc4f38)
#24 0x0000000001bdda69 clang::CodeGenAction::ExecuteAction()
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1bdda69)
#25 0x00000000018eee16 clang::FrontendAction::Execute()
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x18eee16)
#26 0x00000000018c1146
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x18c1146)
#27 0x00000000019748a2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x19748a2)
#28 0x000000000091d048 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x91d048)
#29 0x00000000008dfa54 main
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x8dfa54)
#30 0x00007f9d3704a830 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20830)
#31 0x0000000000919a19 _start
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x919a19)
Stack dump:
0.      Program arguments:
/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-resource-dir /home/vlivinsk/workspace/llvm/bin-trunk/bin/../lib/clang/4.0.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/vlivinsk/workspace/llvm/bin-trunk/bin/../lib/clang/4.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O0
-fdeprecated-macro -fdebug-compilation-dir
/home/vlivinsk/workspace/yarpgen/found/scalar/clang/S_2303193238 -ferror-limit
19 -fmessage-length 114 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -o /tmp/small-5565b8.o -x c++ small.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'small.cpp'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@_Z1jv'
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 284990)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/vlivinsk/workspace/llvm/bin-trunk/bin
clang-4.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-4.0: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /tmp/small-b391d6.cpp
clang-4.0: note: diagnostic msg: /tmp/small-b391d6.sh
clang-4.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/20161027/7cc1d5c5/attachment.html>


More information about the llvm-bugs mailing list