https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80646
Bug ID: 80646 Summary: [Regression] wrong type info for extern inline function when compiling Emacs Product: gcc Version: 6.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: eggert at gnu dot org Target Milestone: --- Created attachment 41327 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41327&action=edit gzipped tarball of three source files illustrating the bug GCC 6.3.1 x86-64 20161221 (Red Hat 6.3.1-1) outputs incorrect debug information for inline functions in some cases, and this can make programs hard to debug. The problem does not occur for GCC 4.8.5 20150623 (Red Hat 4.8.5-11), so this appears to be a regression. I ran into the problem while attempting to debug GNU Emacs, and constructed a small test case to illustrate it. To reproduce it on Fedora 25 x86-64 with 6.3.1 20161221, extract the files lisp.h, t.c and u.c from the attached tarball, and compile them by running the shell command: gcc -g3 -O2 t.c u.c Then use GDB as follows: $ gdb a.out ... (gdb) ptype make_number type = int () (gdb) ptype make_natnum type = struct { long i; } (long) (gdb) ptype XIL type = struct { long i; } (long) (gdb) The reported type of 'make_number' is incorrect: it should be the same type as that of make_natnum and XIL, but instead is a function returning 'int'. This incorrect type can cause GDB to print incorrect results in expressions involving make_number. Looking at the assembly-language output, it appears that GCC is generating the wrong debug information for this example.