<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 -O2 and above with polly and newgvn: Assertion `ArrayAccess && "No array access found for instruction!"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=34464">34464</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes at -O2 and above with polly and newgvn: Assertion `ArrayAccess && "No array access found for instruction!"' 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>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>Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>polly-dev@googlegroups.com
          </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>The hashtag for polly is 8c351e694ba7.

$ clang-trunk -v
clang version 6.0.0 (trunk 312472)
Target: x86_64-unknown-linux-gnu


$ clang-trunk -O2 -mllvm -enable-newgvn -mllvm -polly abc.c
abc.c:19:9: warning: incompatible pointer types assigning to 'char *' from
'short *' [-Wincompatible-pointer-types]
      h = &d;
        ^ ~~
abc.c:22:3: warning: expression result unused [-Wunused-value]
  a ?: (c = 3);
  ^~~~~~~~~~~~
abc.c:12:13: warning: implicit conversion from 'int' to 'short' changes value
from 50423 to -15113 [-Wconstant-conversion]
  short g = 50423;
        ~   ^~~~~
clang-6.0: /home/absozero/trunk/llvm/tools/polly/include/polly/ScopInfo.h:1494:
polly::MemoryAccess& polly::ScopStmt::getArrayAccessFor(const
llvm::Instruction*) const: Assertion `ArrayAccess && "No array access found for
instruction!"' failed.
#0 0x00000000020c60aa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x20c60aa)
#1 0x00000000020c3f2e llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x20c3f2e)
#2 0x00000000020c4082 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x20c4082)
#3 0x00007ff353705330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007ff352282c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007ff352286028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007ff35227bbf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007ff35227bca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x000000000279369f (/home/absozero/trunk/root-clang/bin/clang-6.0+0x279369f)
#9 0x0000000002793efd
polly::BlockGenerator::generateArrayLoad(polly::ScopStmt&, llvm::LoadInst*,
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/root-clang/bin/clang-6.0+0x2793efd)
#10 0x000000000279506f 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/root-clang/bin/clang-6.0+0x279506f)
#11 0x000000000279519b 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/root-clang/bin/clang-6.0+0x279519b)
#12 0x000000000279a13a 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/root-clang/bin/clang-6.0+0x279a13a)
#13 0x00000000027a7b13 IslNodeBuilder::createUser(isl_ast_node*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x27a7b13)
#14 0x00000000027a4a58 IslNodeBuilder::createBlock(isl_ast_node*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x27a4a58)
#15 0x000000000274a0d0 CodeGen(polly::Scop&, polly::IslAstInfo&,
llvm::LoopInfo&, llvm::DominatorTree&, llvm::ScalarEvolution&,
llvm::RegionInfo&) [clone .constprop.273]
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x274a0d0)
#16 0x0000000001761693 llvm::RGPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1761693)
#17 0x0000000001c1f913 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1c1f913)
#18 0x0000000001c1f9dc llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1c1f9dc)
#19 0x0000000001c1f4ad llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1c1f4ad)
#20 0x000000000226f076 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/root-clang/bin/clang-6.0+0x226f076)
#21 0x0000000002a7415f
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2a7415f)
#22 0x0000000002c46488 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2c46488)
#23 0x0000000002a7356c clang::CodeGenAction::ExecuteAction()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2a7356c)
#24 0x0000000002616b5e clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2616b5e)
#25 0x00000000025e6446
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x25e6446)
#26 0x00000000026a8833
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x26a8833)
#27 0x0000000000af62a8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0xaf62a8)
#28 0x0000000000a76171 main
(/home/absozero/trunk/root-clang/bin/clang-6.0+0xa76171)
#29 0x00007ff35226df45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#30 0x0000000000af27b9 _start
(/home/absozero/trunk/root-clang/bin/clang-6.0+0xaf27b9)
Stack dump:
0.      Program arguments: /home/absozero/trunk/root-clang/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
-dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir
/home/absozero/trunk/root-clang/lib/clang/6.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/lib/clang/6.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/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -mllvm -enable-newgvn
-mllvm -polly -o /tmp/abc-99d808.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.body3'
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 312472)
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/abc-918c70.c
clang-6.0: note: diagnostic msg: /tmp/abc-918c70.sh
clang-6.0: note: diagnostic msg:

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



$ cat abc.c
char a, e;
int b;
short c, d;
void fn1() {
  char f;
  for (; 42 <= 5;)
  l1 : {
    b = f;
    for (;;)
      ;
  }
  short g = 50423;
  for (; g; g++) {
    char *h;
    e = 7;
    for (; e <= 71; e++) {
      c += f = d;
      6 ? *h = 0 : 0;
      h = &d;
    }
  }
  a ?: (c = 3);
  goto l1;
}</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>