<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 with "-O3 -mllvm -polly -mllvm -enable-newgvn" on x86_64-linux-gnu (Segmentation fault, polly::ScopStmt::getDomain)"
   href="https://bugs.llvm.org/show_bug.cgi?id=34418">34418</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>polly crashes with "-O3 -mllvm -polly -mllvm -enable-newgvn" on x86_64-linux-gnu (Segmentation fault, polly::ScopStmt::getDomain)
          </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>chengniansun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I have to enable both newgvn and polly to trigger this bug. 

$ clang-trunk -v
clang version 6.0.0 (trunk 312331)
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 small.c -O3 -mllvm -polly -mllvm -enable-newgvn
#0 0x0000000002131a0a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-6.0+0x2131a0a)
#1 0x000000000212fabe llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-6.0+0x212fabe)
#2 0x000000000212fc22 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-6.0+0x212fc22)
#3 0x00007f3b8e03e330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x0000000003c8e308 isl_set_copy
(/usr/local/clang-trunk/bin/clang-6.0+0x3c8e308)
#5 0x000000000274184d polly::ScopStmt::getDomain() const
(/usr/local/clang-trunk/bin/clang-6.0+0x274184d)
#6 0x0000000002711013 polly::ZoneAlgorithm::getDomainFor(polly::ScopStmt*)
const (/usr/local/clang-trunk/bin/clang-6.0+0x2711013)
#7 0x000000000271104d polly::ZoneAlgorithm::getDomainFor(polly::MemoryAccess*)
const (/usr/local/clang-trunk/bin/clang-6.0+0x271104d)
#8 0x000000000270a5ff (anonymous
namespace)::DeLICMImpl::tryMapValue(polly::ScopArrayInfo const*,
isl::noexceptions::map) (/usr/local/clang-trunk/bin/clang-6.0+0x270a5ff)
#9 0x000000000270e72c (anonymous namespace)::DeLICMImpl::greedyCollapse()
(/usr/local/clang-trunk/bin/clang-6.0+0x270e72c)
#10 0x000000000271000a (anonymous namespace)::DeLICM::runOnScop(polly::Scop&)
(/usr/local/clang-trunk/bin/clang-6.0+0x271000a)
#11 0x000000000186c9dd llvm::RGPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-6.0+0x186c9dd)
#12 0x0000000001ce5353 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1ce5353)
#13 0x0000000001ce53fc llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1ce53fc)
#14 0x0000000001ce5c8f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-6.0+0x1ce5c8f)
#15 0x00000000022bbe03 (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+0x22bbe03)
#16 0x00000000022bd11f 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+0x22bd11f)
#17 0x0000000002a9487b
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-6.0+0x2a9487b)
#18 0x0000000002cb27e2 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-6.0+0x2cb27e2)
#19 0x0000000002a93f1f clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-6.0+0x2a93f1f)
#20 0x0000000002653ac6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-6.0+0x2653ac6)
#21 0x000000000262b09e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-6.0+0x262b09e)
#22 0x00000000026e249b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-6.0+0x26e249b)
#23 0x0000000000c20bb8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-6.0+0xc20bb8)
#24 0x0000000000baddaf main (/usr/local/clang-trunk/bin/clang-6.0+0xbaddaf)
#25 0x00007f3b8ce17f45 __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:321:0
#26 0x0000000000c1c1d9 _start (/usr/local/clang-trunk/bin/clang-6.0+0xc1c1d9)
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-2/res/20170901-clang-trunk-m32-Weverything-g-O3-mllvm-enable-newgvn-mllvm-polly-build-014733/delta
-ferror-limit 19 -fmessage-length 238 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-mllvm -polly -mllvm -enable-newgvn -o /tmp/small-79ee16.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 - DeLICM/DePRE' on basic block '%for.body'
clang-6.0: error: unable to execute command: Segmentation fault (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (trunk 312331)
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-92dd8d.c
clang-6.0: note: diagnostic msg: /tmp/small-92dd8d.sh
clang-6.0: note: diagnostic msg:

********************
$ cat small.c
int a, c, d, e, f, g, i;
unsigned b;
int h[1];
int main() {
  short j;
  for (; i; i++) {
    short k = ~1 / (j || g << c) && a;
    int l = k / ~(~d % b), m = a || c;
    if (b) {
      j = e || -d / ~j;
      d = ~m - ~c;
      c = m ^ ~f;
      if (b < 3064379042)
        break;
    }
    d = l;
    h[i] = 0;
  }
  int n;
  while (a)
    for (; n; n++)
      ;
}
$</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>