<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - polly crashes at -O3 on x86_64-linux-gnu (Assertion `New && "Unexpected scalar dependence in region!"' failed.)"
   href="https://bugs.llvm.org/show_bug.cgi?id=34429">34429</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>polly crashes at -O3 on x86_64-linux-gnu (Assertion `New && "Unexpected scalar dependence in region!"' failed.)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Polly
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>polly-dev@googlegroups.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chengniansun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang-trunk -v
clang version 6.0.0 (trunk 312414)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
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.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.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ clang-trunk -O3 -mllvm -polly small.c
clang-6.0:
/tmp/llvm-builder/llvm-source-trunk/tools/polly/lib/CodeGen/BlockGenerators.cpp:208:
llvm::Value* polly::BlockGenerator::getNewValue(polly::ScopStmt&, llvm::Value*,
polly::ValueMapT&, llvm::LoopToScevMapT&, llvm::Loop*) const: Assertion `New &&
"Unexpected scalar dependence in region!"' failed.
#0 0x00000000021345ea llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-6.0+0x21345ea)
#1 0x000000000213269e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-6.0+0x213269e)
#2 0x0000000002132802 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-6.0+0x2132802)
#3 0x00007f8d36865330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f8d35653c37 gsignal
/build/eglibc-MjiXCM/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f8d35657028 abort
/build/eglibc-MjiXCM/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f8d3564cbf6 __assert_fail_base
/build/eglibc-MjiXCM/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f8d3564cca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x00000000027b9fbd polly::BlockGenerator::getNewValue(polly::ScopStmt&,
llvm::Value*, llvm::DenseMap<llvm::AssertingVH<llvm::Value>,
llvm::AssertingVH<llvm::Value>,
llvm::DenseMapInfo<llvm::AssertingVH<llvm::Value> >,
llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::Value>,
llvm::AssertingVH<llvm::Value> > >&, llvm::DenseMap<llvm::Loop const*,
llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*>,
llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*> >&,
llvm::Loop*) const (/usr/local/clang-trunk/bin/clang-6.0+0x27b9fbd)
#9 0x00000000027bf555 polly::RegionGenerator::addOperandToPHI(polly::ScopStmt&,
llvm::PHINode*, llvm::PHINode*, llvm::BasicBlock*, llvm::DenseMap<llvm::Loop
const*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*>,
llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*> >&)
(/usr/local/clang-trunk/bin/clang-6.0+0x27bf555)
#10 0x00000000027bf7ce
polly::RegionGenerator::copyPHIInstruction(polly::ScopStmt&, llvm::PHINode*,
llvm::DenseMap<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>,
llvm::DenseMapInfo<llvm::AssertingVH<llvm::Value> >,
llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::Value>,
llvm::AssertingVH<llvm::Value> > >&, llvm::DenseMap<llvm::Loop const*,
llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*>,
llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*> >&)
(/usr/local/clang-trunk/bin/clang-6.0+0x27bf7ce)
#11 0x00000000027bafef polly::BlockGenerator::copyInstruction(polly::ScopStmt&,
llvm::Instruction*, llvm::DenseMap<llvm::AssertingVH<llvm::Value>,
llvm::AssertingVH<llvm::Value>,
llvm::DenseMapInfo<llvm::AssertingVH<llvm::Value> >,
llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::Value>,
llvm::AssertingVH<llvm::Value> > >&, llvm::DenseMap<llvm::Loop const*,
llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*>,
llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*> >&,
isl_id_to_ast_expr*) (/usr/local/clang-trunk/bin/clang-6.0+0x27bafef)
#12 0x00000000027bb0ab polly::BlockGenerator::copyBB(polly::ScopStmt&,
llvm::BasicBlock*, llvm::BasicBlock*,
llvm::DenseMap<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>,
llvm::DenseMapInfo<llvm::AssertingVH<llvm::Value> >,
llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::Value>,
llvm::AssertingVH<llvm::Value> > >&, llvm::DenseMap<llvm::Loop const*,
llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*>,
llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*> >&,
isl_id_to_ast_expr*) (/usr/local/clang-trunk/bin/clang-6.0+0x27bb0ab)
#13 0x00000000027c0735 polly::RegionGenerator::copyStmt(polly::ScopStmt&,
llvm::DenseMap<llvm::Loop const*, llvm::SCEV const*,
llvm::DenseMapInfo<llvm::Loop const*>, llvm::detail::DenseMapPair<llvm::Loop
const*, llvm::SCEV const*> >&, isl_id_to_ast_expr*)
(/usr/local/clang-trunk/bin/clang-6.0+0x27c0735)
#14 0x00000000027cc2d4 IslNodeBuilder::createUser(isl_ast_node*)
(/usr/local/clang-trunk/bin/clang-6.0+0x27cc2d4)
#15 0x00000000027c8ba8 IslNodeBuilder::createBlock(isl_ast_node*)
(/usr/local/clang-trunk/bin/clang-6.0+0x27c8ba8)
#16 0x00000000027c9603 IslNodeBuilder::createIf(isl_ast_node*)
(/usr/local/clang-trunk/bin/clang-6.0+0x27c9603)
#17 0x000000000277a510 CodeGen(polly::Scop&, polly::IslAstInfo&,
llvm::LoopInfo&, llvm::DominatorTree&, llvm::ScalarEvolution&,
llvm::RegionInfo&) (/usr/local/clang-trunk/bin/clang-6.0+0x277a510)
#18 0x000000000186dd2d llvm::RGPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-6.0+0x186dd2d)
#19 0x0000000001ce6be3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1ce6be3)
#20 0x0000000001ce6c8c llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1ce6c8c)
#21 0x0000000001ce751f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1ce751f)
#22 0x00000000022be8f3 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-6.0+0x22be8f3)
#23 0x00000000022bfc0f 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> >)
(/usr/local/clang-trunk/bin/clang-6.0+0x22bfc0f)
#24 0x0000000002a974ab
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-6.0+0x2a974ab)
#25 0x0000000002cb5412 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-6.0+0x2cb5412)
#26 0x0000000002a96b4f clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-6.0+0x2a96b4f)
#27 0x0000000002656636 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-6.0+0x2656636)
#28 0x000000000262dc0e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-6.0+0x262dc0e)
#29 0x00000000026e500b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-6.0+0x26e500b)
#30 0x0000000000c20cf8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-6.0+0xc20cf8)
#31 0x0000000000badeef main (/usr/local/clang-trunk/bin/clang-6.0+0xbadeef)
#32 0x00007f8d3563ef45 __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:321:0
#33 0x0000000000c1c319 _start (/usr/local/clang-trunk/bin/clang-6.0+0xc1c319)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/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
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/lib/clang/6.0.0 -c-isystem
/usr/local/include/csmith-2.2.0/ -c-isystem /usr/local/include/csmith-2.2.0/
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/lib/clang/6.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/cnsun/ramdisk/hermes/run-1/res/20170902-clang-trunk-m32-Weverything-g-O3-mllvm-enable-newgvn-mllvm-polly-build-015449/delta
-ferror-limit 19 -fmessage-length 270 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-mllvm -polly -o /tmp/small-899bdb.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 'Region Pass Manager' on function '@main'
5.      Running pass 'Polly - Create LLVM-IR from SCoPs' on basic block
'%for.cond'
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 6.0.0 (trunk 312414)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-6.0: 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-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-15460f.c
clang-6.0: note: diagnostic msg: /tmp/small-15460f.sh
clang-6.0: note: diagnostic msg: 

********************
$ cat small.c
int a, b, c, d, e, g;
short f;
int fn1(p1) { return a == 0 ?: p1 % a; }

int main() {
  int j;
  for (;;) {
    f = 0;
    for (; f <= 0; f++) {
      j || (b ^= 10);
      d = fn1(g && ~(j = (unsigned short)(char) e));
      if (c)
        return 2;
    }
    e = 9;
  }
  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>