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

            Bug ID: 105488
           Summary: Function definition is not generated OR function is
                    not inlined
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pavel.morozkin at gmail dot com
  Target Milestone: ---

Note: probably this is a duplicate.

This code:
inline void f(void)
{
}

int main(void)
{
  f();
}

leads to this code:
        .file   "t609.c"
        .text
        .def    __main; .scl    2;      .type   32;     .endef
        .globl  main
        .def    main;   .scl    2;      .type   32;     .endef
        .seh_proc       main
main:
        pushq   %rbp
        .seh_pushreg    %rbp
        movq    %rsp, %rbp
        .seh_setframe   %rbp, 0
        subq    $32, %rsp
        .seh_stackalloc 32
        .seh_endprologue
        call    __main
        call    f
        movl    $0, %eax
        addq    $32, %rsp
        popq    %rbp
        ret
        .seh_endproc
        .ident  "GCC: (GNU) 11.1.0"
        .def    f;      .scl    2;      .type   32;     .endef

Here we see that "call f" is present, while "f:" is absent.

As a result:
$ gcc t609.c
ld: /tmp/cc8z1GjU.o:t609.c:(.text+0xe): undefined reference to `f'
collect2: error: ld returned 1 exit status

I think that:
- either function definition is not generated,
- either function is not inlined.

Reply via email to