https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70485
Bug ID: 70485
Summary: Duplicate typedef results in missing debug info
Product: gcc
Version: 4.8.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: freezer.spam at gmail dot com
Target Milestone: ---
Created attachment 38149
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38149&action=edit
gcc version output
For the past few years, GCC has allowed duplicate typedefs as long as they're
compatible with each other. The issue I'm facing is with DWARF debugging
extensions: it seems that GCC marks duplicate typedefs as unused, and does not
include them in DWARF.
Example:
typedef struct yyx yyx_handle;
typedef struct yyx yyx_handle;
yyx_handle *get_yyx(void *p)
{ return (yyx_handle *)p; }
Results:
$ gcc -o f1.o -c f1.c -g
$ readelf --debug-dump f1.o | grep yyx_handle | wc -l
0
If I add -fno-eliminate-unused-debug-types the typedef is included, but then
all my unused types appear as well, blowing up the object file size.
The obvious workaround is to remove the duplicate definition, but that's not
always practical.