This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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, RFA] libstdc++/24975: aliasing rules violations in set/multiset


Paolo Carlini <pcarlini@suse.de> writes:

| Hi,
| 
| this is about a rather nasty issue, that we inherited from the original
| HP/SGI code. We had, in stl_set.h and stl_multiset.h, things like:
| 
|        iterator
|        insert(iterator __position, const value_type& __x)
|       {
|             typedef typename _Rep_type::iterator _Rep_iterator;
|             return _M_t.insert_unique((_Rep_iterator&)__position, __x);
|       }
| 
| and those casts, breaking strict aliasing rules led to miscompilations
| together with the improved alias analysis that we have now in
| 4_1-branch. For example, that *actually* happened for DLV, a package
| maintained by Gerald:
| 
|     http://www.dbai.tuwien.ac.at/proj/dlv/
| 
| Richard confirmed that my fix below cures the problem - indeed is pretty
| much straightforward and safe from the binary compatibility point of
| view - but I'm still wondering whether we can do better (e.g., less
| redundancy in stl_tree.h), still paying the highest attention to those
| general requirements. Otherwise, I mean to apply it soon.

I thought we had more than that -- funny though, I
came across a year ago but said "hum, who cares?" :-(

That is good stuff.

-- Gaby


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