[llvm-bugs] [Bug 35840] New: clang crashes on valid code at -O2 and -O3 while running pass 'Jump Threading'
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jan 5 19:51:11 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=35840
Bug ID: 35840
Summary: clang crashes on valid code at -O2 and -O3 while
running pass 'Jump Threading'
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: su at cs.ucdavis.edu
CC: llvm-bugs at lists.llvm.org
Tested with trunk revision 321905.
$ clangpolly -v
clang version 7.0.0 (http://llvm.org/git/clang.git
8ab750617f6c3c5e50ad8bcf932b3bde36d8a111) (http://llvm.org/git/llvm.git
135e942bcbf1e59d0c5e177510c20d3e3c3039c7)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.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.4
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.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
$
$ clangpolly -Os small.c; ./a.out
$
$ clangpolly -O2 small.c
#0 0x0000000002144c2a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x0000000002142abe llvm::sys::RunSignalHandlers()
/home/su/software/tmp/polly/llvm/lib/Support/Signals.cpp:50:0
#2 0x0000000002142c32 SignalHandler(int)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:242:0
#3 0x00007f5bc38f9390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x0000000001852fc6 llvm::matchSelectPattern(llvm::Value*, llvm::Value*&,
llvm::Value*&, llvm::Instruction::CastOps*)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:4595:0
#5 0x0000000001852119 matchMinMaxOfMinMax
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:4173:0
#6 0x0000000001852119 matchMinMax
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:4252:0
#7 0x0000000001852119 matchSelectPattern(llvm::CmpInst::Predicate,
llvm::FastMathFlags, llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*,
llvm::Value*&, llvm::Value*&)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:4432:0
#8 0x0000000001852fcb llvm::matchSelectPattern(llvm::Value*, llvm::Value*&,
llvm::Value*&, llvm::Instruction::CastOps*)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:4595:0
...
#504 0x0000000001852fcb llvm::matchSelectPattern(llvm::Value*, llvm::Value*&,
llvm::Value*&, llvm::Instruction::CastOps*)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:4595:0
#505 0x0000000001852119 matchMinMaxOfMinMax
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:4173:0
#506 0x0000000001852119 matchMinMax
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:4252:0
#507 0x0000000001852119 matchSelectPattern(llvm::CmpInst::Predicate,
llvm::FastMathFlags, llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*,
llvm::Value*&, llvm::Value*&)
/home/su/software/tmp/polly/llvm/lib/Analysis/ValueTracking.cpp:4432:0
Stack dump:
0. Program arguments: /home/su/software/tmp/polly/llvm_build/bin/clang-6.0
-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 -dwarf-column-info -debugger-tuning=gdb
-momit-leaf-frame-pointer -resource-dir
/home/su/software/tmp/polly/llvm_build/lib/clang/7.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/su/software/tmp/polly/llvm_build/lib/clang/7.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdebug-compilation-dir /home/su -ferror-limit 19 -fmessage-length 116
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-loops -vectorize-slp -o /tmp/small-b23784.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 'Jump Threading' on function '@main'
clang-6.0: error: unable to execute command: Segmentation fault (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (http://llvm.org/git/clang.git
8ab750617f6c3c5e50ad8bcf932b3bde36d8a111) (http://llvm.org/git/llvm.git
135e942bcbf1e59d0c5e177510c20d3e3c3039c7)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
clang-6.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-6.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-6.0: note: diagnostic msg: /tmp/small-cee743.c
clang-6.0: note: diagnostic msg: /tmp/small-cee743.sh
clang-6.0: note: diagnostic msg:
********************
$
-----------------------------------
int printf (const char *, ...);
int a, d, e, f, g, h;
int fn1 (int c)
{
return c > 0 ? c : a;
}
void fn2 ()
{
while (!e)
printf ("\n");
for (; 1; g = fn1 (g))
{
while (f)
while (1)
;
if (e)
break;
while (1)
{
d |= h;
if (d)
break;
e = 1;
}
}
}
int main ()
{
if (a)
fn2 ();
return 0;
}
--
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/20180106/069d3568/attachment-0001.html>
More information about the llvm-bugs
mailing list