<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 - test/memprof/TestCases/stress_dtls.c fails on CentOS"
   href="https://bugs.llvm.org/show_bug.cgi?id=50447">50447</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>test/memprof/TestCases/stress_dtls.c fails on CentOS
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>12.0
          </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>asan
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>bryanpkc@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When build LLVM 12 with GCC 9.3.0, and running "make check-memprof" on CentOS
7, I see these failures:

  Failed Tests (2):
    MemProfiler-x86_64-linux :: TestCases/stress_dtls.c
    MemProfiler-x86_64-linux-dynamic :: TestCases/stress_dtls.c

The failing step is this:

  // RUN:
%env_memprof_opts=log_path=stderr:verbosity=2:intercept_tls_get_addr=0 setarch
`uname -m` -R %run %t 10 2 2>&1 | FileCheck %s --check-prefix=CHECK0

The CHECK0-NOT pattern inside the test case checks that the word
"__tls_get_addr" is not reported. If I run the command by hand outside
llvm-lit, it succeeds:

$ env MEMPROF_OPTIONS=log_path=stderr:verbosity=2:intercept_tls_get_addr=0
$PWD/build/projects/compiler-rt/test/memprof/X86_64LinuxConfig/TestCases/Output/stress_dtls.c.tmp
10 2 2>&1 | build/bin/FileCheck
compiler-rt/test/memprof/TestCases/stress_dtls.c --check-prefix=CHECK0 && echo
OK
OK

However, llvm-lit prepends ${LLVM_BINARY_DIR}/bin to the $PATH variable, which
changes the behaviour of the test:

$ env PATH=$PWD/build/bin:$PATH
MEMPROF_OPTIONS=log_path=stderr:verbosity=2:intercept_tls_get_addr=0
$PWD/build/projects/compiler-rt/test/memprof/X86_64LinuxConfig/TestCases/Output/stress_dtls.c.tmp
10 2 2>&1 | build/bin/FileCheck
compiler-rt/test/memprof/TestCases/stress_dtls.c --check-prefix=CHECK0 && echo
OK
compiler-rt/test/memprof/TestCases/stress_dtls.c:25:16: error: CHECK0-NOT:
excluded string found in input
// CHECK0-NOT: __tls_get_addr
               ^
<stdin>:253:31: note: found here
 #2 0x43168d in __interceptor___tls_get_addr
/home/bryanpkc/llvm/compiler-rt/lib/memprof/../sanitizer_common/sanitizer_common_interceptors.inc:5299:35
                              ^~~~~~~~~~~~~~

Input file: <stdin>
Check file: compiler-rt/test/memprof/TestCases/stress_dtls.c

-dump-input=help explains the following input dump.

Input was:
<<<<<<
        .
        .
        .
      248:  #2 0x7f84e0aed3d4 in __libc_start_main (/lib64/libc.so.6+0x223d4)
      249:
      250: Stack for id 1207959553:
      251:  #0 0x450547 in __libc_memalign
/home/bryanpkc/llvm/compiler-rt/lib/memprof/memprof_malloc_linux.cpp:165:3
      252:  #1 0x7f84e1dc5f67 in tls_get_addr_tail
(/lib64/ld-linux-x86-64.so.2+0x11f67)
      253:  #2 0x43168d in __interceptor___tls_get_addr
/home/bryanpkc/llvm/compiler-rt/lib/memprof/../sanitizer_common/sanitizer_common_interceptors.inc:5299:35
not:25                                   !~~~~~~~~~~~~~                        
                                                                               
               error: no match expected
      254:  #3 0x43168d in __tls_get_addr
/home/bryanpkc/llvm/compiler-rt/lib/memprof/../sanitizer_common/sanitizer_common_interceptors.inc:5296:1
      255:
      256: Stack for id 1468006401:
      257:  #0 0x44fd9f in calloc
/home/bryanpkc/llvm/compiler-rt/lib/memprof/memprof_malloc_linux.cpp:136:3
      258:  #1 0x7f84e1dc66c4 in _dl_allocate_tls
(/lib64/ld-linux-x86-64.so.2+0x126c4)
        .
        .
        .
<span class="quote">>>>>>></span ></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>