[llvm-bugs] [Bug 33088] New: libomp crash in __tls_get_addr when clang is bootstrapped with LTO

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 18 01:46:48 PDT 2017


            Bug ID: 33088
           Summary: libomp crash in __tls_get_addr when clang is
                    bootstrapped with LTO
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Runtime Library
          Assignee: unassignedbugs at nondot.org
          Reporter: ismail at i10z.com
                CC: llvm-bugs at lists.llvm.org

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
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
==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

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170518/fdacd25c/attachment-0001.html>

More information about the llvm-bugs mailing list