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

            Bug ID: 116869
           Summary: Profiler count register conflicts with regparm
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jwjagersma at gmail dot com
  Target Milestone: ---

On i386 targets that pass a profiler count address in EDX, the second
argument to a regparm function is clobbered:

$ cat test.c
__attribute((regparm(2)))
int add (int a, int b)
{
  return a + b;
}

$ i386-pc-msdosdjgpp-gcc -S test.c -O -pg -o -
        .file   "test.c"
        .section .text
        .globl  _add
_add:
        pushl   %ebp
        movl    %esp, %ebp
        .section .data
        .p2align 2
LP0:
        .long   0
        .section .text
        movl    $LP0, %edx
1:      call    _mcount
        addl    %edx, %eax
        popl    %ebp
        ret
        .ident  "GCC: (GNU) 14.2.0"

Reply via email to