<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 with new-gvn and polly: original tableau does not correspond to original basic map"
   href="https://bugs.llvm.org/show_bug.cgi?id=37758">37758</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes with new-gvn and polly: original tableau does not correspond to original basic map
          </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>isl
          </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>As the title. It happens at -O1 and above.


$ clang-trunk -v
clang version 7.0.0 (trunk 334344)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/3.4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
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.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.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8.0.1
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64



$ clang-trunk -mllvm -polly -mllvm -enable-newgvn -O1 abc.c
<a few warningings...>
/home/absozero/trunk/llvm/tools/polly/lib/External/isl/isl_coalesce.c:2858:
original tableau does not correspond to original basic map
Stack dump:
0.      Program arguments: /home/absozero/trunk/root-clang/bin/clang-7 -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/7.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/lib/clang/7.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/reduction/crash -ferror-limit
19 -fmessage-length 158 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -mllvm -polly -mllvm -enable-newgvn -o /tmp/abc-f824d3.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 - Optimize schedule of SCoP' on basic block
'%for.body6'
#0 0x0000000002075d14 PrintStackTraceSignalHandler(void*)
(/home/absozero/trunk/root-clang/bin/clang-7+0x2075d14)
#1 0x0000000002073cfe llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-7+0x2073cfe)
#2 0x0000000002075ed2 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-7+0x2075ed2)
#3 0x00007fef9d028330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007fef9bc03c37 gsignal
/build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fef9bc07028 abort
/build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0
#6 0x000000000417c3ac (/home/absozero/trunk/root-clang/bin/clang-7+0x417c3ac)
#7 0x000000000417109e coalesce_after_aligning_divs
(/home/absozero/trunk/root-clang/bin/clang-7+0x417109e)
#8 0x000000000416baf7 coalesce_range
(/home/absozero/trunk/root-clang/bin/clang-7+0x416baf7)
#9 0x000000000416b264 isl_map_coalesce
(/home/absozero/trunk/root-clang/bin/clang-7+0x416b264)
#10 0x0000000004247814 un_entry
(/home/absozero/trunk/root-clang/bin/clang-7+0x4247814)
#11 0x0000000004183ef1 isl_hash_table_foreach
(/home/absozero/trunk/root-clang/bin/clang-7+0x4183ef1)
#12 0x00000000042437e9 un_op
(/home/absozero/trunk/root-clang/bin/clang-7+0x42437e9)
#13 0x0000000004243c32 isl_union_map_coalesce
(/home/absozero/trunk/root-clang/bin/clang-7+0x4243c32)
#14 0x00000000027bbe89 polly::Dependences::addPrivatizationDependences()
(/home/absozero/trunk/root-clang/bin/clang-7+0x27bbe89)
#15 0x00000000027bd42a polly::Dependences::calculateDependences(polly::Scop&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x27bd42a)
#16 0x00000000027bf1c3
polly::DependenceInfo::recomputeDependences(polly::Dependences::AnalysisLevel)
(/home/absozero/trunk/root-clang/bin/clang-7+0x27bf1c3)
#17 0x00000000027981e7 (anonymous
namespace)::IslScheduleOptimizer::runOnScop(polly::Scop&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x27981e7)
#18 0x000000000166436f llvm::RGPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x166436f)
#19 0x0000000001b46ec6 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1b46ec6)
#20 0x0000000001b47193 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1b47193)
#21 0x0000000001b476f0 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1b476f0)
#22 0x000000000223af79 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-7+0x223af79)
#23 0x0000000002b61113
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x2b61113)
#24 0x00000000030f0924 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-7+0x30f0924)
#25 0x00000000026da350 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-7+0x26da350)
#26 0x0000000002683951
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x2683951)
#27 0x000000000277e649
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-7+0x277e649)
#28 0x0000000000912d28 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-7+0x912d28)
#29 0x000000000091066f main
(/home/absozero/trunk/root-clang/bin/clang-7+0x91066f)
#30 0x00007fef9bbeef45 __libc_start_main
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
#31 0x000000000090d6fd _start
(/home/absozero/trunk/root-clang/bin/clang-7+0x90d6fd)
clang-7: error: unable to execute command: Aborted (core dumped)
clang-7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (trunk 334344)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-7: 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-7: note: diagnostic msg:
********************

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

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



$ cat abc.c
long a, d, i;
short b, f, h, k;
char c, e, j;
int g;
void fn1() {
  char *l = &e;
  int m = l = &f;
  for (; f;) {
    if (a || (h = m)) {
      int *n = &m;
      for (; m <= 1; m++)
        (m & 28 ? *l : 0 == 0) || (d += a);
      for (; m <= 3;)
        n = &a;
      for (; m;) {
        l = &h;
        *n %= i;
      }
      for (;;)
        ;
    }
    *l = 3;
  }
  if ((m |= f) | *l ^ (m = 1)) {
    char **o = &l;
    for (; a;) {
      **o += *o;
      if ((m || *o) && **o) {
        fn2() || (m ^= 4);
        g = **o;
        *o = fn2;
      }
      l && (m %= e);
      if (k) {
        *o = &c;
        m %= c;
      }
      *l = 2;
      b &= m;
      **o = 9;
      for (; **o;)
        m %= j;
    }
    if (m * (l <= 0))
    l1:
    **o = *l;
  }
  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>