<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Assertion `ShiftBits != 0 && MaskBits <= Size' failed."
href="https://llvm.org/bugs/show_bug.cgi?id=30813">30813</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Assertion `ShiftBits != 0 && MaskBits <= Size' failed.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>Vsevolod.Livinskij@frtk.ru
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=17502" name="attach_17502" title="Reproducer.">attachment 17502</a> <a href="attachment.cgi?id=17502&action=edit" title="Reproducer.">[details]</a></span>
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:
<span class="quote">>$ clang++ -O0 small.cpp</span >
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
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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:
********************</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>