[Bug libstdc++/24975] Aliasing problems inside libstdc++
pcarlini at suse dot de
gcc-bugzilla@gcc.gnu.org
Tue Nov 22 16:14:00 GMT 2005
------- Comment #17 from pcarlini at suse dot de 2005-11-22 16:14 -------
(In reply to comment #15)
> So that leaves us with basic_string and it's problems. What do you suggest to
> vendors needing ABI compatibility?
Richard, something we *can* safely apply (safely from the ABI point of view) is
this hack (vaguely inspired by HP/SGI hacks...). I don't think it can make the
underlying issue *worse*, at least. What do you think?
Index: include/bits/basic_string.h
===================================================================
--- include/bits/basic_string.h (revision 107363)
+++ include/bits/basic_string.h (working copy)
@@ -177,7 +177,10 @@
static _Rep&
_S_empty_rep()
- { return *reinterpret_cast<_Rep*>(&_S_empty_rep_storage); }
+ {
+ void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);
+ return *reinterpret_cast<_Rep*>(__p);
+ }
bool
_M_is_leaked() const
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24975
More information about the Gcc-bugs
mailing list