<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 - clang crashes at -O1 and above with polly and newgvn"
   href="https://bugs.llvm.org/show_bug.cgi?id=34423">34423</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes at -O1 and above with polly and newgvn
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>My clang was installed according to  <a href="https://polly.llvm.org/get_started.html">https://polly.llvm.org/get_started.html</a>.



$ ~/trunk/polly/polly-root/bin/clang -v
clang version 6.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
48231c128c697271508e83b487d436a071e62f09) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
074e282b60af6fa3954381faba5b121df4f4ea99)
Target: x86_64-unknown-linux-gnu
Thread model: posix



$ ~/trunk/polly/polly-root/bin/clang -mllvm -enable-newgvn -mllvm -polly  -O1
abc.c
abc.c:7:5: warning: incompatible pointer types assigning to 'int *' from 'long
*' [-Wincompatible-pointer-types]
  d = &c;
    ^ ~~
abc.c:10:5: warning: expression result unused [-Wunused-value]
    (c %= f) ?: a && (*d = b);
    ^~~~~~~~~~~~~~~~~~~~~~~~~
clang-6.0:
/home/absozero/trunk/polly/llvm_git/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 0x000000000232e6ba llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x232e6ba)
#1 0x000000000232c84e llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x232c84e)
#2 0x000000000232c9b0 SignalHandler(int)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x232c9b0)
#3 0x00007f7a2186f340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f7a20660cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f7a206640d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f7a20659b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f7a20659c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x00000000029fd96d 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
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x29fd96d)
#9 0x0000000002a03335 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*> >&)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x2a03335)
#10 0x0000000002a0359e
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*> >&)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x2a0359e)
#11 0x00000000029fec69 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*)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x29fec69)
#12 0x00000000029fed1b 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*)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x29fed1b)
#13 0x0000000002a044d0 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*)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x2a044d0)
#14 0x0000000002a107d8 IslNodeBuilder::createUser(isl_ast_node*)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x2a107d8)
#15 0x0000000002a0cfe8 IslNodeBuilder::createBlock(isl_ast_node*)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x2a0cfe8)
#16 0x0000000002a0de33 IslNodeBuilder::createIf(isl_ast_node*)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x2a0de33)
#17 0x00000000029b9c54 CodeGen(polly::Scop&, polly::IslAstInfo&,
llvm::LoopInfo&, llvm::DominatorTree&, llvm::ScalarEvolution&,
llvm::RegionInfo&)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x29b9c54)
#18 0x00000000019f9c3d llvm::RGPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x19f9c3d)
#19 0x0000000001eab8e3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x1eab8e3)
#20 0x0000000001eab98c llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x1eab98c)
#21 0x0000000001eac1fa llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x1eac1fa)
#22 0x00000000024cdf95 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x24cdf95)
#23 0x00000000024cf373 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/absozero/trunk/polly/polly-root/bin/clang-6.0+0x24cf373)
#24 0x0000000002cf17bf
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x2cf17bf)
#25 0x0000000002f14d9c clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x2f14d9c)
#26 0x0000000002cf0c60 clang::CodeGenAction::ExecuteAction()
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x2cf0c60)
#27 0x0000000002883796 clang::FrontendAction::Execute()
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x2883796)
#28 0x00000000028563f6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x28563f6)
#29 0x000000000291f352
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0x291f352)
#30 0x0000000000d47dc8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0xd47dc8)
#31 0x0000000000cd513c main
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0xcd513c)
#32 0x00007f7a2064bec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#33 0x0000000000d436e9 _start
(/home/absozero/trunk/polly/polly-root/bin/clang-6.0+0xd436e9)
Stack dump:
0.      Program arguments: /home/absozero/trunk/polly/polly-root/bin/clang-6.0
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
abc.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
/home/absozero/trunk/polly/polly-root/lib/clang/6.0.0 -c-isystem
/usr/local/include/csmith-2.3.0 -c-isystem . -cxx-isystem
/usr/local/include/csmith-2.3.0 -cxx-isystem . -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/polly/polly-root/lib/clang/6.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O1
-fdebug-compilation-dir /home/absozero/projects/reduction1 -ferror-limit 19
-fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -mllvm -enable-newgvn -mllvm -polly -o /tmp/abc-3bdd0f.o -x
c abc.c
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'abc.c'.
4.      Running pass 'Region Pass Manager' on function '@fn1'
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 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
48231c128c697271508e83b487d436a071e62f09) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
074e282b60af6fa3954381faba5b121df4f4ea99)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/absozero/trunk/polly/polly-root/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/abc-69c97d.c
clang-6.0: note: diagnostic msg: /tmp/abc-69c97d.sh
clang-6.0: note: diagnostic msg:

********************

$ cat abc.c
int a, b;
long c;
int *d;
short e, f;
char g;
void fn1() {
  d = &c;
  for (;;) {
    c = *d ? e ?: 1 | (g |= f) : 1;
    (c %= f) ?: a && (*d = b);
    for (; e <= 8;)
      ;
  }
}</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>