<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 - [regression 9.0.0] -mllvm -polly-parallel is crashing clang"
   href="https://bugs.llvm.org/show_bug.cgi?id=43164">43164</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[regression 9.0.0] -mllvm -polly-parallel is crashing clang
          </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>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Other
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>sylvestre@debian.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, llvm@meinersbur.de, tobias@grosser.es
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>42474
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This code works with clang 8

echo "
#define N 1536
float A[N][N];
float B[N][N];
float C[N][N];

void init_array()
{
    int i, j;
    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) {
            A[i][j] = (1+(i*j)%1024)/2.0;
            B[i][j] = (1+(i*j)%1024)/2.0;
        }
    }
}

int main()
{
    int i, j, k;
    double t_start, t_end;
    init_array();
    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) {
            C[i][j] = 0;
            for (k = 0; k < N; k++)
                C[i][j] = C[i][j] + A[i][k] * B[k][j];
        }
    }
    return 0;
}
" > foo.c
clang-$VERSION -O3 -mllvm -polly foo.c
=> works

clang-$VERSION -O3 -mllvm -polly -mllvm -polly-parallel foo.c
=> crashes with

Stack dump:
0.      Program arguments: /usr/lib/llvm-9/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name foo.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 -resource-dir /usr/lib/llvm-9/lib/clang/9.0.0
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/llvm-9/lib/clang/9.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/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/9 -ferror-limit 19
-fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -mllvm -polly -mllvm
-polly-parallel -faddrsig -o /tmp/foo-f16d16.o -x c foo.c 
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'foo.c'.
4.      Running pass 'Region Pass Manager' on function '@main'
5.      Running pass 'Polly - Create LLVM-IR from SCoPs' on basic block '%9'
 #0 0x00007fcb76737dff llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xb74dff)
 #1 0x00007fcb76736210 llvm::sys::RunSignalHandlers()
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xb73210)
 #2 0x00007fcb76738201 (/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xb75201)
 #3 0x00007fcb7c403730 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12730)
 #4 0x00007fcb774a3bad llvm::RegionBase<llvm::RegionTraits<llvm::Function>
<span class="quote">>::blocks() (/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0x18e0bad)</span >
 #5 0x00000000005729d7 addReferencesFromStmt(polly::ScopStmt const*, void*,
bool) (/usr/lib/llvm-9/bin/clang+0x5729d7)
 #6 0x00000000005733ca IslNodeBuilder::getReferencesInSubtree(isl_ast_node*,
llvm::SetVector<llvm::Value*, std::vector<llvm::Value*,
std::allocator<llvm::Value*> >, llvm::DenseSet<llvm::Value*,
llvm::DenseMapInfo<llvm::Value*> > >&, llvm::SetVector<llvm::Loop const*,
std::vector<llvm::Loop const*, std::allocator<llvm::Loop const*> >,
llvm::DenseSet<llvm::Loop const*, llvm::DenseMapInfo<llvm::Loop const*> > >&)
(/usr/lib/llvm-9/bin/clang+0x5733ca)
 #7 0x0000000000575910 IslNodeBuilder::createForParallel(isl_ast_node*)
(/usr/lib/llvm-9/bin/clang+0x575910)
 #8 0x00000000005775fd IslNodeBuilder::createBlock(isl_ast_node*)
(/usr/lib/llvm-9/bin/clang+0x5775fd)
 #9 0x0000000000575188
IslNodeBuilder::createForSequential(isl::noexceptions::ast_node, bool)
(/usr/lib/llvm-9/bin/clang+0x575188)
#10 0x0000000000576a98 IslNodeBuilder::createFor(isl_ast_node*)
(/usr/lib/llvm-9/bin/clang+0x576a98)
#11 0x000000000057488d IslNodeBuilder::createMark(isl_ast_node*)
(/usr/lib/llvm-9/bin/clang+0x57488d)
#12 0x00000000005748b7 IslNodeBuilder::createMark(isl_ast_node*)
(/usr/lib/llvm-9/bin/clang+0x5748b7)
#13 0x000000000057761c IslNodeBuilder::createBlock(isl_ast_node*)
(/usr/lib/llvm-9/bin/clang+0x57761c)
#14 0x000000000053a3e3 (/usr/lib/llvm-9/bin/clang+0x53a3e3)
#15 0x00007fcb774aa9f1 llvm::RGPassManager::runOnFunction(llvm::Function&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0x18e79f1)
#16 0x00007fcb768358a6 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xc728a6)
#17 0x00007fcb76835b53 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xc72b53)
#18 0x00007fcb76836000 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/lib/x86_64-linux-gnu/libLLVM-9.so.1+0xc73000)
#19 0x00007fcb7b1808b2 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/lib/x86_64-linux-gnu/libclang-cpp.so.9+0x125e8b2)
#20 0x00007fcb7b3b248d (/usr/lib/x86_64-linux-gnu/libclang-cpp.so.9+0x149048d)
#21 0x00007fcb7a71bd53 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.9+0x7f9d53)
#22 0x00007fcb7b980a48 clang::FrontendAction::Execute()
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.9+0x1a5ea48)
#23 0x00007fcb7b9405e0
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.9+0x1a1e5e0)
#24 0x00007fcb7b9e35b0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/x86_64-linux-gnu/libclang-cpp.so.9+0x1ac15b0)
#25 0x00000000004a3f6b cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-9/bin/clang+0x4a3f6b)
#26 0x00000000004a2291 main (/usr/lib/llvm-9/bin/clang+0x4a2291)
#27 0x00007fcb756af09b __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
#28 0x000000000049f70a _start (/usr/lib/llvm-9/bin/clang+0x49f70a)
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0-+rc2-1~exp2 (tags/RELEASE_900/rc2)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/foo-e49ed6.c
clang: note: diagnostic msg: /tmp/foo-e49ed6.sh
clang: note: diagnostic msg: 

********************</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - [meta] 9.0.0 Release Blockers"
   href="https://bugs.llvm.org/show_bug.cgi?id=42474">Bug 42474</a>] [meta] 9.0.0 Release Blockers
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>