<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 --- - clang crashes on vector extension code with invalid use of shift: in llvm::BinaryOperator::init"
href="https://llvm.org/bugs/show_bug.cgi?id=28706">28706</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang crashes on vector extension code with invalid use of shift: in llvm::BinaryOperator::init
</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>All
</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>su@cs.ucdavis.edu
</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>The current clang trunk crashes when compiling the following test case on
x86_64-linux-gnu in both 32-bit and 64-bit modes.
It also crashes all versions since 3.3.x and is properly rejected by 3.2.
$ clang -v
clang version 4.0.0 (trunk 276574)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.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.1.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang small.c
clang-4.0: /tmp/llvm-builder/llvm-source-trunk/lib/IR/Instructions.cpp:2124:
void llvm::BinaryOperator::init(llvm::Instruction::BinaryOps): Assertion
`(getType()->isIntegerTy() || (getType()->isVectorTy() &&
cast<VectorType>(getType())->getElementType()->isIntegerTy())) && "Tried to
create a shift operation on a non-integral type!"' failed.
#0 0x0000000001d6c945 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1d6c945)
#1 0x0000000001d6a9fe llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1d6a9fe)
#2 0x0000000001d6ab60 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1d6ab60)
#3 0x00007f858b700340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f858a4f1cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f858a4f50d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f858a4eab86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f858a4eac32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x00000000019ada18 llvm::BinaryOperator::init(llvm::Instruction::BinaryOps)
(/usr/local/clang-trunk/bin/clang-4.0+0x19ada18)
#9 0x00000000019add47
llvm::BinaryOperator::BinaryOperator(llvm::Instruction::BinaryOps,
llvm::Value*, llvm::Value*, llvm::Type*, llvm::Twine const&,
llvm::Instruction*) (/usr/local/clang-trunk/bin/clang-4.0+0x19add47)
#10 0x00000000019ade3d
llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*,
llvm::Value*, llvm::Twine const&, llvm::Instruction*)
(/usr/local/clang-trunk/bin/clang-4.0+0x19ade3d)
#11 0x000000000207b3b5 (anonymous
namespace)::ScalarExprEmitter::EmitShl((anonymous namespace)::BinOpInfo const&)
(/usr/local/clang-trunk/bin/clang-4.0+0x207b3b5)
#12 0x00000000020863d2 (anonymous
namespace)::ScalarExprEmitter::EmitCompoundAssignLValue(clang::CompoundAssignOperator
const*, llvm::Value* ((anonymous namespace)::ScalarExprEmitter::*)((anonymous
namespace)::BinOpInfo const&), llvm::Value*&) [clone .constprop.724]
(/usr/local/clang-trunk/bin/clang-4.0+0x20863d2)
#13 0x0000000002086b05 (anonymous
namespace)::ScalarExprEmitter::EmitCompoundAssign(clang::CompoundAssignOperator
const*, llvm::Value* ((anonymous namespace)::ScalarExprEmitter::*)((anonymous
namespace)::BinOpInfo const&)) [clone .constprop.723]
(/usr/local/clang-trunk/bin/clang-4.0+0x2086b05)
#14 0x000000000208256c (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x208256c)
#15 0x0000000002083d93
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2083d93)
#16 0x000000000204c3ff clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x204c3ff)
#17 0x000000000205e60d
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x205e60d)
#18 0x0000000001f090bc clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*) (/usr/local/clang-trunk/bin/clang-4.0+0x1f090bc)
#19 0x0000000001f09ecf
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f09ecf)
#20 0x0000000001f30282
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) (/usr/local/clang-trunk/bin/clang-4.0+0x1f30282)
#21 0x0000000001f3b166
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f3b166)
#22 0x0000000001f57f21
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-4.0+0x1f57f21)
#23 0x0000000001f68eb1
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-4.0+0x1f68eb1)
#24 0x0000000001f69dd1
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/usr/local/clang-trunk/bin/clang-4.0+0x1f69dd1)
#25 0x0000000001f6a4e1
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone
.part.6373] (/usr/local/clang-trunk/bin/clang-4.0+0x1f6a4e1)
#26 0x00000000024ee11b (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/clang-trunk/bin/clang-4.0+0x24ee11b)
#27 0x00000000024e88fc
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/clang-trunk/bin/clang-4.0+0x24e88fc)
#28 0x000000000284b466 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x284b466)
#29 0x00000000024e941e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x24e941e)
#30 0x00000000021f8a9e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x21f8a9e)
#31 0x00000000021ce666
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x21ce666)
#32 0x0000000002285612
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2285612)
#33 0x0000000000b1e8f0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xb1e8f0)
#34 0x0000000000accfe2 main (/usr/local/clang-trunk/bin/clang-4.0+0xaccfe2)
#35 0x00007f858a4dcec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#36 0x0000000000b1a8d4 _start (/usr/local/clang-trunk/bin/clang-4.0+0xb1a8d4)
Stack dump:
0. Program arguments: /usr/local/clang-trunk/bin/clang-4.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.c -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 /usr/local/clang-trunk/bin/../lib/clang/4.0.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-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 -fdebug-compilation-dir /data2
-ferror-limit 19 -fmessage-length 152 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small-bc1df7.o -x c
small.c
1. <eof> parser at end of file
2. small.c:1:5: LLVM IR generation of declaration 'main'
3. small.c:1:5: Generating code for declaration 'main'
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 276574)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-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-35a93f.c
clang-4.0: note: diagnostic msg: /tmp/small-35a93f.sh
clang-4.0: note: diagnostic msg:
********************
$
------------------------------------------------------------------------------
int main ()
{
__attribute__ ((vector_size ((1) * sizeof (float)))) float avec = { 1.0 };
__attribute__ ((vector_size ((1) * sizeof (int)))) int bvec = { 1 };
avec <<= bvec;
return 0;
}</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>