[llvm-bugs] [Bug 27280] New: [ppc64] add noinline attribute to "PrintCurrentStackSlow" cause print-stack-trace.cc test fail

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 8 04:26:55 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27280

            Bug ID: 27280
           Summary: [ppc64] add noinline attribute to
                    "PrintCurrentStackSlow" cause print-stack-trace.cc
                    test fail
           Product: compiler-rt
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: cycheng at multicorewareinc.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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)

-- 
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/20160408/ca02281d/attachment.html>


More information about the llvm-bugs mailing list