http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55844



             Bug #: 55844

           Summary: -fsanitize=address -Os -fno-omit-frame-pointer

                    -mno-omit-leaf-frame-pointer -m64 doesn't work

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: sanitizer

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: hjl.to...@gmail.com

                CC: do...@gcc.gnu.org, dvyu...@gcc.gnu.org,

                    ja...@gcc.gnu.org, k...@gcc.gnu.org





c-c++-common/asan/null-deref-1.c fails with -m64 since



-fsanitize=address -Os -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer

-m64 



still omit frame pointer:



[hjl@gnu-tools-1 gcc]$  cat /tmp/x.c

void

NullDeref(int *ptr)

{

  ptr[10]++;

}

[hjl@gnu-tools-1 gcc]$

/export/build/gnu/gcc-x32-mx32/build-x86_64-linux/gcc/xgcc

-B/export/build/gnu/gcc-x32-mx32/build-x86_64-linux/gcc/ /tmp/x.c   -S   -Os 

-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -m64 -fsanitize=address

[hjl@gnu-tools-1 gcc]$ cat x.s

    .file    "x.c"

    .text

    .globl    NullDeref

    .type    NullDeref, @function

NullDeref:

.LFB0:

    .cfi_startproc

    movq    %rdi, %rax

    leaq    40(%rdi), %rdi

    movabsq    $17592186044416, %rdx

    movq    %rdi, %rcx

    shrq    $3, %rcx

    movb    (%rcx,%rdx), %dl

    movq    %rdi, %rcx

    andl    $7, %ecx

    addl    $3, %ecx

    cmpb    %dl, %cl

    jl    .L2

    testb    %dl, %dl

    je    .L2

    pushq    %rbp

    .cfi_def_cfa_offset 16

    .cfi_offset 6, -16

    movq    %rsp, %rbp

    .cfi_def_cfa_register 6

    call    __asan_report_load4

.L2:

    .cfi_def_cfa 7, 8

    .cfi_restore 6

    incl    40(%rax)

    ret

    .cfi_endproc

.LFE0:

    .size    NullDeref, .-NullDeref

    .section    .text.startup,"ax",@progbits

    .type    _GLOBAL__sub_I_00099_0_NullDeref, @function

_GLOBAL__sub_I_00099_0_NullDeref:

.LFB1:

    .cfi_startproc

    pushq    %rbp

    .cfi_def_cfa_offset 16

    .cfi_offset 6, -16

    movq    %rsp, %rbp

    .cfi_def_cfa_register 6

    popq    %rbp

    .cfi_def_cfa 7, 8

    jmp    __asan_init

    .cfi_endproc

.LFE1:

    .size    _GLOBAL__sub_I_00099_0_NullDeref,

.-_GLOBAL__sub_I_00099_0_NullDeref

    .section    .init_array.00099,"aw"

    .align 8

    .quad    _GLOBAL__sub_I_00099_0_NullDeref

    .ident    "GCC: (GNU) 4.8.0 20130101 (experimental)"

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

[hjl@gnu-tools-1 gcc]$

/export/build/gnu/gcc-x32-mx32/build-x86_64-linux/gcc/xgcc

-B/export/build/gnu/gcc-x32-mx32/build-x86_64-linux/gcc/ /tmp/x.c   -S   -Os 

-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -m64 

[hjl@gnu-tools-1 gcc]$ cat x.s

    .file    "x.c"

    .text

    .globl    NullDeref

    .type    NullDeref, @function

NullDeref:

.LFB0:

    .cfi_startproc

    pushq    %rbp

    .cfi_def_cfa_offset 16

    .cfi_offset 6, -16

    incl    40(%rdi)

    movq    %rsp, %rbp

    .cfi_def_cfa_register 6

    popq    %rbp

    .cfi_def_cfa 7, 8

    ret

    .cfi_endproc

.LFE0:

    .size    NullDeref, .-NullDeref

    .ident    "GCC: (GNU) 4.8.0 20130101 (experimental)"

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

[hjl@gnu-tools-1 gcc]$

Reply via email to