https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63354

            Bug ID: 63354
           Summary: -pg -mprofile-kernel creates unused stack frames on
                    leaf functions on ppc64le
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anton at samba dot org

The following testcase:

int foo(void)
{
    return 1;
}

compiled with:

gcc -O2 -pg -mprofile-kernel -S foo.c

produces an unused stack frame:

foo:
    mflr 0
    std 0,16(1)
    bl _mcount
    mflr 0
    li 3,1
    std 0,16(1)
    stdu 1,-32(1)
    addi 1,1,32
    ori 2,2,0
    ld 0,16(1)
    mtlr 0
    blr

Note that older gcc versions allowed -mprofile-kernel to used on its own. While
there are issues with that (eg ignoring attribute no_instrument_function), it
does show the expected behaviour:

gcc -O2 -mprofile-kernel -S foo.c

foo:
    mflr 0
    std 0,16(1)
    bl _mcount
    li 3,1
    blr

So it seems to be something to do with -pg.

Reply via email to