<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - [ppc64] add noinline attribute to "PrintCurrentStackSlow" cause print-stack-trace.cc test fail"
   href="https://llvm.org/bugs/show_bug.cgi?id=27280">27280</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ppc64] add noinline attribute to "PrintCurrentStackSlow" cause print-stack-trace.cc test fail
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.8
          </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>compiler-rt
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>cycheng@multicorewareinc.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>It fails on PPC64 + linux platform.

Reproduce Step:

1. add noinline attribute to PrintCurrentStackSlow

vi llvm/projects/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc

__attribute__((noinline))
void PrintCurrentStackSlow(uptr pc) {
#ifndef SANITIZER_GO
..
#endif
}

2. make -j8 check-sanitizer
   Then you get test failure.

3. Expect output:
    #0 0x100a53b8 in __sanitizer_print_stack_trace
    #1 0x100d55ac in FooBarBaz()
    #2 0x100d5544 in main

   But we actually get:
    #0 0x100a53b8 in __sanitizer_print_stack_trace
    #1 0x100a25c0 in __tsan::PrintCurrentStackSlow(unsigned long)
    #2 0x100d55ac in FooBarBaz()
    #3 0x100d5544 in main

4. Disassemble of tsan_rtl_report.cc.o

  __sanitizer_print_stack_trace:
        mflr 0
        std 0,16(1)
        stdu 1,-32(1)
        bl _ZN11__sanitizer10StackTrace12GetCurrentPcEv
        nop
        addi 1,1,32
        ld 0,16(1)
        mtlr 0
        b _ZN6__tsan21PrintCurrentStackSlowEm    <= becomes a sibling call

5. We found this bug when we enabled sibling-call-optimization for ppc64, and
did clang bootstrap testing. Clang will generate sibling call for
PrintCurrentStackSlow, and looks like it broke some assumption of
PrintCurrentStackSlow.

6. The fastest way to fix this issue is adding "-mllvm -disable-ppc-sco=true"
in
   compiler-rt/lib/tsan/CMakeLists.txt when we are ppc64.

   ${TSAN_RTL_CFLAGS} += -mllvm -disable-ppc-sco=true (if we are on ppc64)</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>