https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78322
Bug ID: 78322
Summary: Debug info still present for fully optimized away
functions
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: dblaikie at gmail dot com
Target Milestone: ---
Consider this:
inline void __attribute__((always_inline)) f1() {
}
inline void __attribute__((always_inline)) f2() {
}
void f() {
f1();
}
GCC produces DWARF for f, and for f1 (where f1 has no high/low pc, no
inlined_subroutines referring to it, etc), but no DWARF for f2.
I think f1 and f2 should be the same - or perhaps a flag to allow them to be
treated the same.
If the function has been entirely optimized away, it's pretty close to not
having ever been called & producing DWARF for it doesn't seem to enhance the
user experience. (if it does, having DWARF for f2 would also enhance the user
experience in the same way) & the extra DWARF this produces (referenced types,
their types, etc) could be part of the reason Clang's DWARF is so much smaller
(1/6th of the type information - but due to several other bugs as well, which
I've filed).