This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/53621] New: [SH] Frame pointers not generated with -fno-omit-frame-pointer on GCC 4.7.0


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

             Bug #: 53621
           Summary: [SH] Frame pointers not generated with
                    -fno-omit-frame-pointer on GCC 4.7.0
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bluecrab2887@netscape.net


With GCC 4.7.0, frame pointers do not seem to be generated when compiling with
-fno-omit-frame-pointer in a sh-elf targeted GCC.

Compiling the following piece of code generates the same assembly, regardless
of whether -fomit-frame-pointer or -fno-omit-frame-pointer is given:


__attribute__((noinline)) int sum3(int x, int y, int z) {
    return x + y + z;
}

int main(int argc, char *argv[]) {
    return sum3(1, 2, 3);
}


The code generated is as follows with GCC 4.7.0:

    .file    "test13.c"
    .text
    .little
    .section    .text.sum3,"ax",@progbits
    .align 1
    .align 5
    .global    _sum3
    .type    _sum3, @function
_sum3:
    mov    r4,r0
    add    r5,r0
    rts    
    add    r6,r0
    .size    _sum3, .-_sum3
    .section    .text.startup.main,"ax",@progbits
    .align 1
    .align 5
    .global    _main
    .type    _main, @function
_main:
    mov.l    .L3,r0
    mov    #1,r4
    mov    #2,r5
    jmp    @r0
    mov    #3,r6
.L4:
    .align 2
.L3:
    .long    _sum3
    .size    _main, .-_main
    .ident    "GCC: (GNU) 4.7.0"


With GCC 4.5.2, essentially identical code is generated for when using
-fomit-frame-pointer. However, with -fno-omit-frame-pointer, frame pointers are
generated as expected:

    .file    "testcase.c"
    .text
    .little
    .text
    .align 1
    .align 5
    .global    _sum3
    .type    _sum3, @function
_sum3:
    mov    r5,r0
    add    r4,r0
    mov.l    r14,@-r15
    add    r6,r0
    mov    r15,r14
    mov    r14,r15
    rts    
    mov.l    @r15+,r14
    .size    _sum3, .-_sum3
    .align 1
    .align 5
    .global    _main
    .type    _main, @function
_main:
    mov.l    .L3,r0
    mov    #1,r4
    mov.l    r14,@-r15
    mov    #2,r5
    mov    #3,r6
    mov    r15,r14
    mov    r14,r15
    jmp    @r0
    mov.l    @r15+,r14
.L4:
    .align 2
.L3:
    .long    _sum3
    .size    _main, .-_main
    .ident    "GCC: (GNU) 4.5.2"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]