This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix backwards compatibility problem in libstdc++

Hi Jakub,

It seems the
changes broke libstdc++ backwards compatibility, some GCC 3.4.x compiled
programs and/or libraries misbehave with GCC 4.0.x and later
The problem is if some 3.4.x program/library has an inlined copy of
_S_construct or _M_clone (that means it initializes _M_length and
_M_refdata's last char, but not _M_refcount) and calls out of line
_S_create (which in GCC 3.4.x used to clear _M_refcount, but after
the above patch it no longer does), then _M_refcount is uninitialized.
When running 3.4.x code against 3.4.x libstdc++ or 4.[01].x code against
4.[01].x libstdc++ there is no problem, in the first case _M_refcount
is initialized in _S_create, in the latter in _S_construct/_M_clone that
call it.

Sob :(

I'm afraid the only safe fix is now to clear _M_refcount in _S_create
in addition to clearing it in its callers (well, it is just one int/long
store, so it shouldn't slow things that much).

Ok for trunk/4.1/4.0?

Yes, certainly ok for now, we can always try to figure out something a tad cleaner at a later stage (the comment is very appropriate indeed).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]