Using
gcc (GCC) 4.4.0 20080909 (experimental)
with optimization level -O3 to compile the attached c++ or .ii file, I get a
huge amount of assembly code.
See the attached source, precompiled source and assembly files.
If compiled with -Os or -O2 code size is way less.
The inlined code that appears to produce that sse instruction storm appears to
originates from ctype<char>::_M_widen_init in bits/locale_facets.h around line
1169.
I am not sure if this is a compiler/optimizer/inliner problem or if libstdc++
is just unlucky implementing the iostream/locale stuff. Since g++ compiles much
better overall optimized code with 4.4 compared to oprevious versions, I hope
that this can be fixed in libstdc++. Just my 2 cent ...
Thanks!
Mathias Fröhlich
--
Summary: Code bloat for ostream.widen('\n')
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: M dot Froehlich at science-computing dot de
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455