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/77835] New: -O2 -pg -m32 overwrites saved lr with bogus value


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

            Bug ID: 77835
           Summary: -O2 -pg -m32 overwrites saved lr with bogus value
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: schwab@linux-m68k.org
  Target Milestone: ---
            Target: powerpc-*-*

When compiling with -O2 -pg the compiler is saving lr twice, once before
_mcount, a second time after it (where it overwrites the saved value with a
bogus one).

$ echo 'int foo (int x) { return x; }' | gcc -O2 -pg -S -m32 -xc - -o -
        .file   ""
        .machine power4
        .section        ".text"
        .align 2
        .p2align 4,,15
        .globl foo
        .type   foo, @function
foo:
        mflr 0
        stw 0,4(1)
        bl _mcount
        stwu 1,-16(1)
        mflr 0
        stw 0,20(1)
        ori 2,2,0
        lwz 0,20(1)
        addi 1,1,16
        mtlr 0
        blr
        .size   foo,.-foo
        .ident  "GCC: (GNU) 7.0.0 20161002 (experimental) [trunk revision
240699]"
        .section        .note.GNU-stack,"",@progbits

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