This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug libstdc++/19495] basic_string::_M_rep() can produce an unnaturally aligned pointer to _Rep


------- Additional Comments From ncm-nospam at cantrip dot org  2005-01-21 15:37 -------
Hmm, it's a little more complicated than I said, although it might be 
academic.  There's an implicit assumption in the code that any type 
on which basic_string<> might be instantiated has no stricter alignment
than _Rep itself.  But that's a different bug.  Probably the right way 
to fix it is to replace the first member of _Rep with an anonymous union:

  size_type               _M_length;

becomes

  union { size_type _M_length; _Some_big_aligned_type _M_alignment_dummy; };

I don't know if gcc supplies a built-in typedef for that.  Without
checking, I think tr1 must do.   I believe this can also be done
without breaking ABI on any actual target.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19495


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