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

            Bug ID: 108315
           Summary: -mcpu=power10 changes ABI
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ABI, wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amonakov at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc64le-*-*

Created attachment 54202
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54202&action=edit
testcase

At least the documentation should mention that if intentional.

In the attached example, the function bar is compiled to

bar:
        .localentry     bar,1
        mtctr 3
        mr 12,3
        bctr
        .long 0
        .byte 0,0,0,0,0,0,0,0

i.e. it does not preserve r2 (it's compiled with -mcpu=power10). If the caller
is not compiled with -mcpu=power10, it needs r2 preserved (bar has a
localentry, so the nop in the caller stays a nop after linking).

I verified the testcase misbehaves on Compile Farm's gcc135: as it does not use
any power10-specific instructions, it's runnable there.

Reply via email to