[llvm-bugs] [Bug 36389] New: clang crashes on valid code at -O3 in 64-bit mode on x86_64-linux-gnu: Assertion `SuccChain.UnscheduledPredecessors == 0 && "Found CFG-violating block"' failed
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 14 22:43:41 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36389
Bug ID: 36389
Summary: clang crashes on valid code at -O3 in 64-bit mode on
x86_64-linux-gnu: Assertion
`SuccChain.UnscheduledPredecessors == 0 && "Found
CFG-violating block"' failed
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 325135. The reduced code is still very hairy.
$ clangpolly -v
clang version 7.0.0 (http://llvm.org/git/clang.git
1532324f1979660b1fc429eff544e1a9c1b79332) (http://llvm.org/git/llvm.git
ba2e473a530286f386d18a95c9de4d673d4a21dc)
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 -m64 -O2 small.c
$ clangpolly -m32 -O3 small.c
$
$ clangpolly -m64 -O3 small.c
clang-6.0:
/home/su/software/tmp/polly/llvm/lib/CodeGen/MachineBlockPlacement.cpp:1591:
llvm::MachineBasicBlock*
{anonymous}::MachineBlockPlacement::selectBestCandidateBlock(const
{anonymous}::BlockChain&, llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&):
Assertion `SuccChain.UnscheduledPredecessors == 0 && "Found CFG-violating
block"' failed.
#0 0x000000000219695a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x00000000021947ee llvm::sys::RunSignalHandlers()
/home/su/software/tmp/polly/llvm/lib/Support/Signals.cpp:50:0
#2 0x0000000002194962 SignalHandler(int)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:242:0
#3 0x00007f5b14372390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007f5b130e4428 gsignal
/build/glibc-bfm8X4/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007f5b130e602a abort /build/glibc-bfm8X4/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007f5b130dcbd7 __assert_fail_base
/build/glibc-bfm8X4/glibc-2.23/assert/assert.c:92:0
#7 0x00007f5b130dcc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x0000000001b60dbe LookupBucketFor<const llvm::MachineBasicBlock*>
/home/su/software/tmp/polly/llvm/include/llvm/ADT/DenseMap.h:618:0
#9 0x0000000001b60dbe lookup
/home/su/software/tmp/polly/llvm/include/llvm/ADT/DenseMap.h:183:0
#10 0x0000000001b60dbe operator()
/home/su/software/tmp/polly/llvm/lib/CodeGen/MachineBlockPlacement.cpp:1571:0
#11 0x0000000001b60dbe operator()<llvm::MachineBasicBlock**>
/usr/include/c++/5/bits/predefined_ops.h:234:0
#12 0x0000000001b60dbe __find_if<llvm::MachineBasicBlock**,
__gnu_cxx::__ops::_Iter_pred<(anonymous
namespace)::MachineBlockPlacement::selectBestCandidateBlock(const (anonymous
namespace)::BlockChain&,
llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&)::<lambda(llvm::MachineBasicBlock*)>
> > /usr/include/c++/5/bits/stl_algo.h:120:0
#13 0x0000000001b60dbe __find_if<llvm::MachineBasicBlock**,
__gnu_cxx::__ops::_Iter_pred<(anonymous
namespace)::MachineBlockPlacement::selectBestCandidateBlock(const (anonymous
namespace)::BlockChain&,
llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&)::<lambda(llvm::MachineBasicBlock*)>
> > /usr/include/c++/5/bits/stl_algo.h:162:0
#14 0x0000000001b60dbe __remove_if<llvm::MachineBasicBlock**,
__gnu_cxx::__ops::_Iter_pred<(anonymous
namespace)::MachineBlockPlacement::selectBestCandidateBlock(const (anonymous
namespace)::BlockChain&,
llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&)::<lambda(llvm::MachineBasicBlock*)>
> > /usr/include/c++/5/bits/stl_algo.h:860:0
#15 0x0000000001b60dbe remove_if<llvm::MachineBasicBlock**, (anonymous
namespace)::MachineBlockPlacement::selectBestCandidateBlock(const (anonymous
namespace)::BlockChain&,
llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&)::<lambda(llvm::MachineBasicBlock*)>
> /usr/include/c++/5/bits/stl_algo.h:937:0
#16 0x0000000001b60dbe
remove_if<llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&, (anonymous
namespace)::MachineBlockPlacement::selectBestCandidateBlock(const (anonymous
namespace)::BlockChain&,
llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&)::<lambda(llvm::MachineBasicBlock*)>
> /home/su/software/tmp/polly/llvm/include/llvm/ADT/STLExtras.h:855:0
#17 0x0000000001b60dbe (anonymous
namespace)::MachineBlockPlacement::selectBestCandidateBlock((anonymous
namespace)::BlockChain const&,
llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&) [clone .constprop.382]
/home/su/software/tmp/polly/llvm/lib/CodeGen/MachineBlockPlacement.cpp:1569:0
#18 0x0000000001b65542 (anonymous
namespace)::MachineBlockPlacement::buildChain(llvm::MachineBasicBlock const*,
(anonymous namespace)::BlockChain&,
llvm::SmallSetVector<llvm::MachineBasicBlock const*, 16u>*) [clone
.constprop.367]
/home/su/software/tmp/polly/llvm/lib/CodeGen/MachineBlockPlacement.cpp:1713:0
#19 0x0000000001b69761 (anonymous
namespace)::MachineBlockPlacement::buildCFGChains() [clone .constprop.358]
/home/su/software/tmp/polly/llvm/lib/CodeGen/MachineBlockPlacement.cpp:2354:0
#20 0x0000000001b6a971 llvm::TargetMachine::requiresStructuredCFG() const
/home/su/software/tmp/polly/llvm/include/llvm/Target/TargetMachine.h:160:0
#21 0x0000000001b6a971 (anonymous
namespace)::MachineBlockPlacement::runOnMachineFunction(llvm::MachineFunction&)
[clone .part.344] [clone .constprop.351]
/home/su/software/tmp/polly/llvm/lib/CodeGen/MachineBlockPlacement.cpp:2775:0
#22 0x0000000001992335
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/su/software/tmp/polly/llvm/lib/CodeGen/MachineFunctionPass.cpp:62:0
#23 0x0000000001cc651b llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1520:0
#24 0x0000000001cc65dc llvm::FPPassManager::runOnModule(llvm::Module&)
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1541:0
#25 0x0000000001cc611d runOnModule
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1597:0
#26 0x0000000001cc611d llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1700:0
#27 0x0000000002352492 llvm::PrettyStackTraceString::~PrettyStackTraceString()
/home/su/software/tmp/polly/llvm/include/llvm/Support/PrettyStackTrace.h:52:0
#28 0x0000000002352492 EmitAssembly
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:806:0
#29 0x0000000002352492 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/tools/clang/lib/CodeGen/BackendUtil.cpp:1180:0
#30 0x0000000002b9a337 std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >::~unique_ptr()
/usr/include/c++/5/bits/unique_ptr.h:235:0
#31 0x0000000002b9a337
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:292:0
#32 0x0000000002d6fc90 clang::ParseAST(clang::Sema&, bool, bool)
/home/su/software/tmp/polly/llvm/tools/clang/lib/Parse/ParseAST.cpp:164:0
#33 0x0000000002b997cf clang::CodeGenAction::ExecuteAction()
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1032:0
#34 0x000000000271e3de clang::FrontendAction::Execute()
/home/su/software/tmp/polly/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:904:0
#35 0x00000000026ed796
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/su/software/tmp/polly/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:992:0
#36 0x00000000027aed6b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/su/software/tmp/polly/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:255:0
#37 0x0000000000ac9da8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/cc1_main.cpp:221:0
#38 0x0000000000a3e920 ExecuteCC1Tool
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/driver.cpp:309:0
#39 0x0000000000a3e920 main
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/driver.cpp:389:0
#40 0x00007f5b130cf830 __libc_start_main
/build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:325:0
#41 0x0000000000ac61d9 _start
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0xac61d9)
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 -O3
-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-caa26e.o -x c small.c
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
'@fn1'
clang-6.0: error: unable to execute command: Aborted (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
1532324f1979660b1fc429eff544e1a9c1b79332) (http://llvm.org/git/llvm.git
ba2e473a530286f386d18a95c9de4d673d4a21dc)
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-d42da2.c
clang-6.0: note: diagnostic msg: /tmp/small-d42da2.sh
clang-6.0: note: diagnostic msg:
********************
$
--------------------------------------------------
int printf (const char *, ...);
struct A
{
int d:1;
int e:8;
unsigned f:2;
} g, n;
int a, h, k, l, o, p, r, v, x, c, aa, ab, z;
short b, t, ac;
unsigned m;
char q, s, u, w, d, e, f, y;
void fn1 (int ae)
{
int af, ag, ah = 0, ai, aj, i, j;
ak:{
short al;
struct A am, an;
int ao, ap = 1, aq = 0 | ap;
if (c)
{
char b;
if (k)
{
if (s)
goto ar;
if (t)
goto as;
goto ak;
}
am.e = aj = printf ("\n");
}
ag = b;
if (!a)
{
if (p < ab)
u++;
for (i = 0; i < 1; i++)
{
int at, au;
if (o)
{
at = -af, au = af;
af = at;
char av = ai % 646563L;
if (t)
ai = printf ("%d\n", ai);
if (b)
goto aw;
e = av;
while (a)
;
ax:
if (o)
{
printf ("%d\n", r);
continue;
}
ar:
if (au)
{
printf ("%d\n", at);
goto ax;
}
if (f && g.f)
break;
}
for (j = 0; j < 2; j++)
{
if (m)
{
while (aj)
if (ag)
printf ("%d\n", p);
printf ("%d\n", y);
}
m = 0;
}
}
if (aa)
while (l)
{
struct A ay;
az:
as:
ay.d = p;
if (ac)
{
al = p;
goto az;
}
if (!al)
continue;
if (q)
{
ac = al / am.f;
goto as;
}
while (ay.f)
printf ("%d%d\n", z, ai);
while (1)
{
printf ("%d\n", i);
ah = t;
break;
}
}
if (h)
aw:
n = g;
else
{
if (b)
an = am;
else
{
for (; aq < 7; aq++)
if (x)
printf ("\n");
printf ("%d\n", ah);
while (1)
return;
}
for (ao = 0; ao < 4; ao++)
while (v)
printf ("%d\n", v);
}
}
s || (w = ae);
while (ah)
if (an.d)
while (w++)
an.e = ae;
}
}
int main ()
{
fn1 (0);
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/20180215/a4b31005/attachment-0001.html>
More information about the llvm-bugs
mailing list