GCC omits the enumeration type if only its enumeration values get used.
The type with its enumerator is described by DWARF if the type itself is used.
enum { a, b };
int v = a;
char s[b];
No "a" or "b" is put in DWARF. Some other variants can be created.
Workaround:
enum { a, b } dummy;
int v = a;
char s[b];
Tested as buggy:
GNU C 4.5.0 20090814 (experimental)
GNU C 4.4.2 20090806 (prerelease)
GNU C 4.4.0 20090506 (Red Hat 4.4.0-4)
--
Summary: DW_TAG_enumeration_type+DW_TAG_enumerator is sometimes
missing
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41065