https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89347
Bug ID: 89347 Summary: gc-sections doesn't remove unused bss section variables. Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: maninder1.s at samsung dot com Target Milestone: --- code snippet:- int init_bss_unused[10] = {0}; // explicilty initialised with 0 int init_bss_used[10] = {0}; // explicilty initialised with 0 int uninit_bss_unused[10]; int uninit_bss_used[10]; int main() { uninit_bss_used[5] = 6; init_bss_used[5] = 7; return 0; } $gcc -fdata-sections -ffunction-sections -Wl,--gc-sections bss.c $nm -a | grep _bss_ 00020714 B init_bss_used // removed init_bss_unused. 00020764 B uninit_bss_unused // not removed.