[LLVMbugs] [Bug 13161] New: Inaccurate CFA tracking in function epilogs

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 20 18:13:43 PDT 2012


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

             Bug #: 13161
           Summary: Inaccurate CFA tracking in function epilogs
           Product: clang
           Version: 3.1
          Platform: PC
        OS/Version: OpenBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthew at dempsky.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


In the assembly output below, the "pop %rbp" instruction modifies the %rbp
register which affects the computation of the CFA, but there's no .cfi_*
directive to reflect this.  If an interrupt occurs between the 'pop' and 'ret'
instructions, the unwind information might be wrong, despite using
-fasynchronous-unwind-tables which is supposed to be exact at every
instruction.


$ cat test.c
#include <stdio.h>

void
foo()
{
        puts("hello");
        puts("good bye");
}

$ clang -S test.c -fasynchronous-unwind-tables    

$ cat test.s
        .file   "test.c"
        .text
        .globl  foo
        .align  16, 0x90
        .type   foo, at function
foo:                                    # @foo
        .cfi_startproc
# BB#0:
        pushq   %rbp
.Ltmp2:
        .cfi_def_cfa_offset 16
.Ltmp3:
        .cfi_offset %rbp, -16
        movq    %rsp, %rbp
.Ltmp4:
        .cfi_def_cfa_register %rbp
        subq    $16, %rsp
        leaq    .L.str, %rdi
        callq   puts
        leaq    .L.str1, %rdi
        movl    %eax, -4(%rbp)          # 4-byte Spill
        callq   puts
        movl    %eax, -8(%rbp)          # 4-byte Spill
        addq    $16, %rsp
        popq    %rbp
        ret
.Ltmp5:
        .size   foo, .Ltmp5-foo
        .cfi_endproc

        .type   .L.str, at object          # @.str
        .section        .rodata.str1.1,"aMS", at progbits,1
.L.str:
        .asciz   "hello"
        .size   .L.str, 6

        .type   .L.str1, at object         # @.str1
.L.str1:
        .asciz   "good bye"
        .size   .L.str1, 9


        .section        ".note.GNU-stack","", at progbits

$ clang --version
clang version 3.1 (branches/release_31)
Target: amd64-unknown-openbsd5.1
Thread model: posix

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list