Open Quuxplusone opened 6 years ago
Bugzilla Link | PR36389 |
Status | NEW |
Importance | P enhancement |
Reported by | Zhendong Su (su@cs.ucdavis.edu) |
Reported on | 2018-02-14 22:43:41 -0800 |
Last modified on | 2018-11-04 03:16:22 -0800 |
Version | unspecified |
Hardware | PC All |
CC | ditaliano@apple.com, llvm-bugs@lists.llvm.org, llvm-dev@ndave.org |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Encountered the same crash again with the following somewhat smaller test
(tested with trunk revision 346071):
$ clangpolly -O3 small.c
clang-6.0:
/home/su/software/tmp/polly/llvm/lib/CodeGen/MachineBlockPlacement.cpp:1599:
llvm::MachineBasicBlock*
{anonymous}::MachineBlockPlacement::selectBestCandidateBlock(const
{anonymous}::BlockChain&, llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&):
Assertion `SuccChain.UnscheduledPredecessors == 0 && "Found CFG-violating
block"' failed.
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/8.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/su/software/tmp/polly/llvm_build/lib/clang/8.0.0/include -internal-
externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem
/include -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir
/home/su -ferror-limit 19 -fmessage-length 96 -fobjc-runtime=gcc -fdiagnostics-
show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/small-
1fe757.o -x c small.c -faddrsig
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'small.c'.
4. Running pass 'Branch Probability Basic Block Placement' on function '@y'
#0 0x00000000024ec3fa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x24ec3fa)
#1 0x00000000024ea78c llvm::sys::RunSignalHandlers()
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x24ea78c)
#2 0x00000000024ea8f7 SignalHandler(int)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x24ea8f7)
#3 0x00007f1dbb868390 __restore_rt (/lib/x86_64-linux-
gnu/libpthread.so.0+0x11390)
#4 0x00007f1dba5da428 gsignal /build/glibc-Cl5G7W/glibc-
2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007f1dba5dc02a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007f1dba5d2bd7 __assert_fail_base /build/glibc-Cl5G7W/glibc-
2.23/assert/assert.c:92:0
#7 0x00007f1dba5d2c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x0000000001e0a991 (anonymous
namespace)::MachineBlockPlacement::selectBestCandidateBlock((anonymous
namespace)::BlockChain const&,
llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&) (.constprop.396)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x1e0a991)
#9 0x0000000001e14d4c (anonymous
namespace)::MachineBlockPlacement::buildCFGChains() (.constprop.363)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x1e14d4c)
#10 0x0000000001e161e5 (anonymous
namespace)::MachineBlockPlacement::runOnMachineFunction(llvm::MachineFunction&)
(.part.344.constprop.354) (/home/su/software/tmp/polly/llvm_build/bin/clang-
6.0+0x1e161e5)
#11 0x0000000001bff291
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(.part.34.constprop.35) (/home/su/software/tmp/polly/llvm_build/bin/clang-
6.0+0x1bff291)
#12 0x0000000001f7fb6c llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x1f7fb6c)
#13 0x0000000001f7fd4c llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x1f7fd4c)
#14 0x0000000001f80e69 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x1f80e69)
#15 0x00000000026cb57d (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x26cb57d)
#16 0x00000000026cce76 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, 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/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x26cce76)
#17 0x0000000002fd9957
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x2fd9957)
#18 0x0000000003591869 clang::ParseAST(clang::Sema&, bool, bool)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x3591869)
#19 0x0000000002fd8ccf clang::CodeGenAction::ExecuteAction()
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x2fd8ccf)
#20 0x0000000002b35f5e clang::FrontendAction::Execute()
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x2b35f5e)
#21 0x0000000002afcd7e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x2afcd7e)
#22 0x0000000002bd7da0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x2bd7da0)
#23 0x0000000000affda8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0xaffda8)
#24 0x0000000000a5d056 main (/home/su/software/tmp/polly/llvm_build/bin/clang-
6.0+0xa5d056)
#25 0x00007f1dba5c5830 __libc_start_main /build/glibc-Cl5G7W/glibc-
2.23/csu/../csu/libc-start.c:325:0
#26 0x0000000000afba49 _start (/home/su/software/tmp/polly/llvm_build/bin/clang-
6.0+0xafba49)
clang-6: error: unable to execute command: Aborted (core dumped)
clang-6: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.0 (http://llvm.org/git/clang.git
6974b990e13dfb4190a6dffdcc8bac9edbd1cde5) (http://llvm.org/git/llvm.git
7fad5fb0d0d32beea4e95e239cc065a850733358)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
clang-6: 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: 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: note: diagnostic msg: /tmp/small-81041e.c
clang-6: note: diagnostic msg: /tmp/small-81041e.sh
clang-6: note: diagnostic msg:
********************
$
---------------------------------------
int printf (const char *, ...);
int a, d, *e;
char b = 1;
short c, k;
static int *f, *g;
void y ()
{
short j = 0, l, p = -1 / b;
unsigned m;
int i, n;
unsigned char o;
if (!(d < l))
{
L1:
o = o % a;
short q = j || k;
char r = c;
int s = q & c;
j = (c || r) | (l & (~0 || d));
if (c && o)
printf ("0");
if (r > 4)
goto L2;
short u = o % b;
if (u)
{
if (l > 0 || o)
{
printf ("%d", c);
goto L1;
}
if (d || c)
goto L3;
}
i = u;
n = s;
if (!d)
goto L1;
if (n)
{
e = f;
if (*f)
printf ("0");
}
short w = ~l;
L2:
if (w > 4)
{
L3:
if (b)
printf ("%d", k);
goto L2;
}
}
if (k > o)
goto L4;
m = i % k;
int h = m ^ j;
if (j)
*f = 0;
while (a)
f++;
if (h)
goto L5;
L4:
if ((c && i < j) || !j)
if (d && i)
{
printf ("%lld", (long long) j);
goto L4;
}
if (m)
*g = 0;
l = p;
int v = -1 / j;
if (c && !n)
goto L2;
L5:
if (v)
goto L1;
int x = n % o;
c = x;
}
int main ()
{
if (a)
y ();
return 0;
}