[Bug c/126702] New: undefined reference to inline function

antonio at gnu dot org via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126702

            Bug ID: 126702
           Summary: undefined reference to inline function
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antonio at gnu dot org
  Target Milestone: ---
              Host: i586, x86_64

Created attachment 65262
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65262&action=edit
24-line source file that reproduces the problem

While building clzip-1.0 I got the following error:
main.c:(.text.startup+0x34c): undefined reference to `resize_buffer'

I have reduced the code to a single 24-line file that reproduces the problem
when compiled with:
gcc -c -o main.o main.c && gcc -o clzip main.o

The function 'resize_buffer' is marked 'inline', but gcc neither inlines it nor
compiles it into main.o. This is the output of 'nm main.o':
00000000 T ap_resize_buffer
00000000 B gbuf
00000015 T main
         U resize_buffer

The bug is present (at least) in versions 16.1.0, 11.2.0, and 10.5.0. Tested on
three different machines with different GCC configurations.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.