This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch, RFA] libstdc++/24975: aliasing rules violations in set/multiset
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: 22 Nov 2005 01:38:14 +0100
- Subject: Re: [Patch, RFA] libstdc++/24975: aliasing rules violations in set/multiset
- References: <43826317.20706@suse.de>
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