Bug 166564

Summary: Wrong default allocator in ext/hash_map
Product: [Fedora] Fedora Reporter: Mattias Ellert <mattias.ellert>
Component: gccAssignee: Benjamin Kosnik <bkoz>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3CC: jakub, mattdm, mnewsome
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
URL: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-07-12 17:36:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The testcase that exemplifies the error
none
Patch against the gcc 3.4.4 STL headers none

Description Mattias Ellert 2005-08-23 12:08:57 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050720 Fedora/1.0.6-1.1.fc3 Firefox/1.0.6

Description of problem:
he attached testcase compiles and runs correctly with gcc 3.3.4, but gives the
following compilation errors with gcc 3.4.4:

hashtest.cxx: In function `int main()':
hashtest.cxx:11: error: cannot convert `int*' to `std::pair<const int, int>*' in
initialization
hashtest.cxx:12: error: no matching function for call to
`std::allocator<int>::construct(std::pair<const int, int>*&, std::pair<const
int, int>&)'
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ext/new_allocator.h:96:
note: candidates are: void __gnu_cxx::new_allocator<_Tp>::construct(_Tp*, const
_Tp&) [with _Tp = int]
hashtest.cxx:17: error: no matching function for call to
`std::allocator<int>::destroy(std::pair<const int, int>*&)'
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ext/new_allocator.h:99:
note: candidates are: void __gnu_cxx::new_allocator<_Tp>::destroy(_Tp*) [with
_Tp = int]
hashtest.cxx:18: error: no matching function for call to
`std::allocator<int>::deallocate(std::pair<const int, int>*&, int)'
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ext/new_allocator.h:86:
note: candidates are: void __gnu_cxx::new_allocator<_Tp>::deallocate(_Tp*,
size_t) [with _Tp = int]

The reason for the errors are wrong default allocators in ext/hash_map. A patch
that fixes the problem is attached.

Version-Release number of selected component (if applicable):
libstdc++-devel-3.4.4-2.fc3

How reproducible:
Always

Steps to Reproduce:
Compile the testcase attached.

Additional info:

The bug has been reported to gcc gnu bugzilla too:

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

Comment 1 Mattias Ellert 2005-08-23 12:11:14 UTC
Created attachment 117998 [details]
The testcase that exemplifies the error

It fails with gcc 3.4.4 but works correctly with gcc 3.3.4

Comment 2 Mattias Ellert 2005-08-23 12:11:51 UTC
Created attachment 117999 [details]
Patch against the gcc 3.4.4 STL headers

With this patch applied to gcc 3.4.4 it compiles correctly with this compiler
too.

Comment 3 Benjamin Kosnik 2005-09-06 19:14:39 UTC
This is fixed in the current gcc-3_4-branch libstdc++ with:

2005-08-29  Paolo Carlini  <pcarlini>

        PR libstdc++/23528
        Port from HEAD/4_0-branch:
	2004-07-28  Matt Austern  <austern>
	* include/ext/hashtable.h: Use rebind so that allocator_type
	has correct type for a container's allocator.
	* testsuite/ext/23528.cc: New.

Comment 4 Matthew Miller 2006-07-10 20:59:33 UTC
Fedora Core 3 is now maintained by the Fedora Legacy project for security
updates only. If this problem is a security issue, please reopen and
reassign to the Fedora Legacy product. If it is not a security issue and
hasn't been resolved in the current FC5 updates or in the FC6 test
release, reopen and change the version to match.

Thank you!


Comment 5 Benjamin Kosnik 2006-07-12 17:36:19 UTC
3.4.0 libstdc++ is currently in deep freeze. Since this is fixed in upstream, ok
to close.