[LLVMbugs] [Bug 21976] New: __builtin_return_address(0) returns junk with the post-RA scheduler

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 19 06:16:18 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21976

            Bug ID: 21976
           Summary: __builtin_return_address(0) returns junk with the
                    post-RA scheduler
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: jay.foad at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13575
  --> http://llvm.org/bugs/attachment.cgi?id=13575&action=edit
test case

With the attached test case I get:

$ llc -o - bra.ll
...
.L.f:
    .cfi_startproc
# BB#0:
    mflr 0
    ld 3, 16(1)
    std 0, 16(1)
    ld 0, 16(1)
    mtlr 0
    blr
...

Note that the return value (register 3) is loaded from the stack *before*
register 0 (copied from the link register) is stored, so this code will return
a junk value.


A workaround is to disable the post-RA scheduler:

$ llc -o - bra.ll -post-RA-scheduler=false
...
.L.f:
    .cfi_startproc
# BB#0:
    mflr 0
    std 0, 16(1)
    ld 3, 16(1)
    ld 0, 16(1)
    mtlr 0
    blr
...

So I guess the post-RA scheduler doesn't understand the dependency between the
store and the load from this stack slot.


This bug is causing the sanitizer test case print-stack-trace.cc to fail on my
PowerPC64 box.

-- 
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/20141219/5ebbdaf2/attachment.html>


More information about the llvm-bugs mailing list