<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 - libomp crash in __tls_get_addr when clang is bootstrapped with LTO"
   href="https://bugs.llvm.org/show_bug.cgi?id=33088">33088</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>libomp crash in __tls_get_addr when clang is bootstrapped with LTO
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Runtime Library
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ismail@i10z.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I bootstrapped clang with (fat-)lto and the following simple openmp code now
crashes at exit:

havana ~ > cat omp_hello.c 
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[]) 
{
int nthreads, tid;

/* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel private(nthreads, tid)
  {

  /* Obtain thread number */
  tid = omp_get_thread_num();
  printf("Hello World from thread = %d\n", tid);

  /* Only master thread does this */
  if (tid == 0) 
    {
    nthreads = omp_get_num_threads();
    printf("Number of threads = %d\n", nthreads);
    }

  }  /* All threads join master thread and disband */

}

havana ~ > clang-5 -v
openSUSE Linux clang version 5.0.0 (trunk 303241) (based on LLVM 5.0.0svn)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /suse/idoenmez/bin
Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/6
Selected GCC installation: /usr/lib64/gcc/x86_64-suse-linux/6
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

havana ~ > clang-5 -g3 -fsanitize=address -fopenmp omp_hello.c -flto
-Wl,-rpath,/opt/clang/lib64
havana ~ > ./a.out 
Hello World from thread = 0
Hello World from thread = 3
Hello World from thread = 7
Hello World from thread = 4
Hello World from thread = 6
Hello World from thread = 5
Hello World from thread = 1
Hello World from thread = 2
Number of threads = 8
ASAN:DEADLYSIGNAL
=================================================================
==2830==ERROR: AddressSanitizer: SEGV on unknown address 0x7fb09cd5a000 (pc
0x7fb09cd5a047 bp 0x7ffdb7a451a0 sp 0x7ffdb7a450d8 T0)
==2830==The signal is caused by a WRITE memory access.
    #0 0x7fb09cd5a046 in __tls_get_addr (/opt/clang/lib64/libomp.so+0x46)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/opt/clang/lib64/libomp.so+0x46) in
__tls_get_addr
==2830==ABORTING</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>