https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120955
--- Comment #31 from fiesh at zefix dot tv ---
Essentially, it boils down to code like this (works equally well with C):
typedef struct {
char a;
char b;
char c;
} H;
H f(void) {
H result = {'a', 'b', 'c'};
return result;
}
This compiles to text size 38 and data size 4 with -Os but to text size 8 and
data size 0 with O2.
(For many such functions, the overall size will become smaller with Os, so the
optimization is meaningful in cases where data and text should be considered
equally expensive.)
So this is neither specific to C++ nor is it really a regression, it's just
triggered in cases previously missed. Should I adapt this issue or open a new
one?
Also, can anyone provide hints what optimization step to look for?