never-used inlines becoming statics

Martin von Loewis martin@mira.isdn.cs.tu-berlin.de
Fri Sep 4 22:50:00 GMT 1998


> One code bloat problem in egcs 1.1 - which I'm considering a _bug_
> because bastring.cc is now unconditionally included by bastring.h -
> is the generation of statics for inlines that are never used or
> referenced at all.

Operating system?

> How to reproduce?  Compile the following program, then run "nm" on the
> generated .o file.
> 
> =====
> #include <stdexcept>
> =====
> 
> No, there's no definitions there.  You can compile this even with -O3 and
> end up with statics that never get used.

I do that on i486-pc-linux-gnu, with binutils 2.9.1, and get

000000b5 ? .L1833
         [more exception frames omitted]
         U __ls__7ostreamPCc
	 [more undefined symbols omitted
00000000 W _t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b1i0.nilRep
00000000 W _t23__malloc_alloc_template1i0.__malloc_alloc_oom_handler
00000000 W _t24__default_alloc_template2b1i0.__node_allocator_lock
00000000 W _t24__default_alloc_template2b1i0.end_free
00000000 W _t24__default_alloc_template2b1i0.free_list
00000000 W _t24__default_alloc_template2b1i0.heap_size
00000000 W _t24__default_alloc_template2b1i0.start_free
00000000 W chunk_alloc__t24__default_alloc_template2b1i0UiRi
00000000 W clone__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b1i0_3Rep
00000000 t gcc2_compiled.
00000000 W oom_malloc__t23__malloc_alloc_template1i0Ui
00000000 W refill__t24__default_alloc_template2b1i0Ui

So I can see exactly one static symbol, gcc2_compiled. This is
intentional and not a bug. The other symbols are all weak: If you link
the program, duplicates of them will be removed (at least on my
system).

In short, I cannot reproduce the problem.

Regards,
Martin



More information about the Gcc-bugs mailing list