[llvm-bugs] [Bug 27902] New: crash at -Os, -O2 and -O3 in 32-bit and 64-bit mode on x86_64-linux-gnu (SimplifiedAddrOp->getValue().getActiveBits() < 64 && "Unexpectedly large index value.")

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 26 16:21:41 PDT 2016


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

            Bug ID: 27902
           Summary: crash at -Os, -O2 and -O3 in 32-bit and 64-bit mode on
                    x86_64-linux-gnu
                    (SimplifiedAddrOp->getValue().getActiveBits() < 64 &&
                    "Unexpectedly large index value.")
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following code crashes the trunk at -Os, -O2 and -O3 in 32-bit and 64-bit
modes on x86_64-linux-gnu. 

$: clang-trunk -v
clang version 3.9.0 (trunk 270535)
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
small.c:5:11: warning: implicit conversion from 'long' to 'int' changes value
from 4221335697 to -73631599 [-Wconstant-conversion]
  int e = 4221335697;
      ~   ^~~~~~~~~~
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/lib/Analysis/LoopUnrollAnalyzer.cpp:123:
bool llvm::UnrolledInstAnalyzer::visitLoad(llvm::LoadInst&): Assertion
`SimplifiedAddrOp->getValue().getActiveBits() < 64 && "Unexpectedly large index
value."' failed.
0  clang-3.9       0x0000000001de54c5
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  clang-3.9       0x0000000001de3456 llvm::sys::RunSignalHandlers() + 54
2  clang-3.9       0x0000000001de3674
3  libpthread.so.0 0x00007fc63e9ef340
4  libc.so.6       0x00007fc63dc0dcc9 gsignal + 57
5  libc.so.6       0x00007fc63dc110d8 abort + 328
6  libc.so.6       0x00007fc63dc06b86
7  libc.so.6       0x00007fc63dc06c32
8  clang-3.9       0x000000000269ddb6
llvm::UnrolledInstAnalyzer::visitLoad(llvm::LoadInst&) + 1350
9  clang-3.9       0x0000000001cdef67
10 clang-3.9       0x0000000001ce28a0
11 clang-3.9       0x0000000001ce332c
12 clang-3.9       0x00000000026a4cfb
llvm::LPPassManager::runOnFunction(llvm::Function&) + 2011
13 clang-3.9       0x0000000001a500d3
llvm::FPPassManager::runOnFunction(llvm::Function&) + 643
14 clang-3.9       0x0000000002682347
15 clang-3.9       0x0000000001a50818
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 872
16 clang-3.9       0x0000000001f32968
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) + 4184
17 clang-3.9       0x00000000025733cd
18 clang-3.9       0x00000000028d473d clang::ParseAST(clang::Sema&, bool, bool)
+ 845
19 clang-3.9       0x000000000257372e clang::CodeGenAction::ExecuteAction() +
78
20 clang-3.9       0x0000000002252bde clang::FrontendAction::Execute() + 286
21 clang-3.9       0x00000000022287f6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 310
22 clang-3.9       0x00000000022df9c2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2370
23 clang-3.9       0x0000000000ad6ee8 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 3272
24 clang-3.9       0x0000000000a909ee main + 6350
25 libc.so.6       0x00007fc63dbf8ec5 __libc_start_main + 245
26 clang-3.9       0x0000000000ad2f54
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/20160526-clang-trunk-m64-g-O3-build-093258/delta
-ferror-limit 19 -fmessage-length 261 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-2ef0db.o -x c small.c 
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'small.c'.
4.      Running pass 'Loop Pass Manager' on function '@fn1'
5.      Running pass 'Unroll loops' on basic block '%for.cond1thread-pre-split'
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 270535)
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
http://llvm.org/bugs/ 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-609b0f.c
clang-3.9: note: diagnostic msg: /tmp/small-609b0f.sh
clang-3.9: note: diagnostic msg: 

********************
$: cat small.c
int a, c, d;
static char b[10] = {7};

void fn1() {
  int e = 4221335697;
  d = 0;
  for (; d < 10; d++) {
    for (; c >= 0; c--)
      a = b[e];
    e--;
  }
}

int main() {}
$:

-- 
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/20160526/9171c4ad/attachment.html>


More information about the llvm-bugs mailing list