<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 --- - crash on x86_64-linux-gnu at -O1 and above in 32-bit and 64-bit modes (Assertion `shiftAmt <= BitWidth && "Invalid shift amount"' failed)"
href="https://llvm.org/bugs/show_bug.cgi?id=26760">26760</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>crash on x86_64-linux-gnu at -O1 and above in 32-bit and 64-bit modes (Assertion `shiftAmt <= BitWidth && "Invalid shift amount"' 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>Windows NT
</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>chengniansun@gmail.com
</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 following code crashes the trunk at -O1 and above in 32-bit and 64-bit
modes on x86_64-linux-gnu.
$: clang-trunk -v
clang version 3.9.0 (trunk 262118)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/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.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.3.0
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.4
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2
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-trunk -O3 small.c
clang-3.9: /tmp/llvm/include/llvm/ADT/APInt.h:870: llvm::APInt
llvm::APInt::shl(unsigned int) const: Assertion `shiftAmt <= BitWidth &&
"Invalid shift amount"' failed.
0 clang-3.9 0x0000000002d7956a
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 44
1 clang-3.9 0x0000000002d7987f
2 clang-3.9 0x0000000002d77f97 llvm::sys::RunSignalHandlers() + 118
3 clang-3.9 0x0000000002d79091
4 libpthread.so.0 0x00007f654386d340
5 libc.so.6 0x00007f6542a8bcc9 gsignal + 57
6 libc.so.6 0x00007f6542a8f0d8 abort + 328
7 libc.so.6 0x00007f6542a84b86
8 libc.so.6 0x00007f6542a84c32
9 clang-3.9 0x00000000016bd729
10 clang-3.9 0x00000000021cebc9
11 clang-3.9 0x0000000002a449ca
12 clang-3.9 0x0000000002a44d31
13 clang-3.9 0x0000000002a457b9
14 clang-3.9 0x0000000002a44466
15 clang-3.9 0x0000000002a47c45
16 clang-3.9 0x00000000029c63f7
17 clang-3.9 0x00000000029c1572
18 clang-3.9 0x00000000029c253e
19 clang-3.9 0x00000000029c285d
20 clang-3.9 0x00000000028be002
llvm::FPPassManager::runOnFunction(llvm::Function&) + 290
21 clang-3.9 0x00000000028be195
llvm::FPPassManager::runOnModule(llvm::Module&) + 97
22 clang-3.9 0x00000000028be530
23 clang-3.9 0x00000000028bec80
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 256
24 clang-3.9 0x00000000028beec1
llvm::legacy::PassManager::run(llvm::Module&) + 39
25 clang-3.9 0x0000000002f6e96c
26 clang-3.9 0x0000000002f6eab3
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*)
+ 127
27 clang-3.9 0x00000000037be6bd
28 clang-3.9 0x000000000400b562 clang::ParseAST(clang::Sema&, bool, bool)
+ 849
29 clang-3.9 0x0000000003410700 clang::ASTFrontendAction::ExecuteAction()
+ 322
30 clang-3.9 0x00000000037bd906 clang::CodeGenAction::ExecuteAction() +
1894
31 clang-3.9 0x00000000034101c5 clang::FrontendAction::Execute() + 135
32 clang-3.9 0x00000000033c82d8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 988
33 clang-3.9 0x0000000003505694
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1062
34 clang-3.9 0x000000000161cca9 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 1052
35 clang-3.9 0x00000000016134ae
36 clang-3.9 0x0000000001613e5e main + 2046
37 libc.so.6 0x00007f6542a76ec5 __libc_start_main + 245
38 clang-3.9 0x0000000001610e99
Stack dump:
0. Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-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 -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir
/data2/c-hunter-results/C/instrument-bugs/REDUCED/20160226-clang-trunk-m32-g-O3-build-204901/delta
-ferror-limit 19 -fmessage-length 196 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-1cd78f.o -x c small.c
1. <eof> parser at end of file
2. Per-module optimization passes
3. Running pass 'Function Pass Manager' on module 'small.c'.
4. Running pass 'Combine redundant instructions' on function '@fn1'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 262118)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-3.9: 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-3.9: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/small-b8af53.c
clang-3.9: note: diagnostic msg: /tmp/small-b8af53.sh
clang-3.9: note: diagnostic msg:
********************
$:
$: cat small.c
static short a;
void fn1() {
int b = 1;
unsigned c;
if (a)
for (; b; --b)
;
LABEL_4o4og:
c = c >> 7 << ~b;
goto LABEL_4o4og;
}
int main() { 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>