public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map
@ 2005-08-23 12:01 mattias dot ellert at tsl dot uu dot se
2005-08-23 12:02 ` [Bug libstdc++/23528] " mattias dot ellert at tsl dot uu dot se
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: mattias dot ellert at tsl dot uu dot se @ 2005-08-23 12:01 UTC (permalink / raw)
To: gcc-bugs
The 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.
--
Summary: Wrong default allocator in ext/hash_map
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mattias dot ellert at tsl dot uu dot se
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
@ 2005-08-23 12:02 ` mattias dot ellert at tsl dot uu dot se
2005-08-23 12:27 ` mattias dot ellert at tsl dot uu dot se
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mattias dot ellert at tsl dot uu dot se @ 2005-08-23 12:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mattias dot ellert at tsl dot uu dot se 2005-08-23 12:01 -------
Created an attachment (id=9563)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9563&action=view)
The testcase that exemplifies the error
It fails with gcc 3.4.4 but works correctly with gcc 3.3.4
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
2005-08-23 12:02 ` [Bug libstdc++/23528] " mattias dot ellert at tsl dot uu dot se
@ 2005-08-23 12:27 ` mattias dot ellert at tsl dot uu dot se
2005-08-23 12:45 ` [Bug libstdc++/23528] [3.4 Regression] " pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mattias dot ellert at tsl dot uu dot se @ 2005-08-23 12:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mattias dot ellert at tsl dot uu dot se 2005-08-23 12:02 -------
Created an attachment (id=9564)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9564&action=view)
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.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
2005-08-23 12:02 ` [Bug libstdc++/23528] " mattias dot ellert at tsl dot uu dot se
2005-08-23 12:27 ` mattias dot ellert at tsl dot uu dot se
@ 2005-08-23 12:45 ` pinskia at gcc dot gnu dot org
2005-08-23 13:16 ` pcarlini at suse dot de
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-23 12:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-23 12:42 -------
This works in both on the mainlline and in 4.0.0. Also the fix is not really a correct fix as this area was
not what changed between 3.4.0 and 4.0.0.
--
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |3.4.0
Known to work| |3.3.3 4.0.0 4.1.0
Summary|Wrong default allocator in |[3.4 Regression] Wrong
|ext/hash_map |default allocator in
| |ext/hash_map
Target Milestone|--- |3.4.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
` (2 preceding siblings ...)
2005-08-23 12:45 ` [Bug libstdc++/23528] [3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2005-08-23 13:16 ` pcarlini at suse dot de
2005-08-23 13:26 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pcarlini at suse dot de @ 2005-08-23 13:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-08-23 13:15 -------
I agree that something much more subtle is going on, maybe even a C++ front-end
bug in 3_4-branch. Notice that hash_map<>::allocator_type is typedef-ed as
_Ht::allocator_type, which, in turn (see the hashtable class in hashtable.h) is,
correctly, an allocator of pair<const _Key, _Tp>. Likewise for
hash_map<>::value_type. More analysis is required...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
` (3 preceding siblings ...)
2005-08-23 13:16 ` pcarlini at suse dot de
@ 2005-08-23 13:26 ` pinskia at gcc dot gnu dot org
2005-08-23 13:35 ` pcarlini at suse dot de
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-23 13:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-23 13:18 -------
I forgot to mention that the preprocessed source from 4.1.0 compiles just fine with the 3.4.0 compiler.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
` (4 preceding siblings ...)
2005-08-23 13:26 ` pinskia at gcc dot gnu dot org
@ 2005-08-23 13:35 ` pcarlini at suse dot de
2005-08-23 13:42 ` pcarlini at suse dot de
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pcarlini at suse dot de @ 2005-08-23 13:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-08-23 13:26 -------
(In reply to comment #5)
I find this very hard to believe: the ext/ headers are basically frozen.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
` (5 preceding siblings ...)
2005-08-23 13:35 ` pcarlini at suse dot de
@ 2005-08-23 13:42 ` pcarlini at suse dot de
2005-08-23 13:43 ` pcarlini at suse dot de
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pcarlini at suse dot de @ 2005-08-23 13:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-08-23 13:34 -------
(In reply to comment #6)
Ok, Andrew is right, just double checked. A big mistery...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
` (6 preceding siblings ...)
2005-08-23 13:42 ` pcarlini at suse dot de
@ 2005-08-23 13:43 ` pcarlini at suse dot de
2005-08-23 13:55 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pcarlini at suse dot de @ 2005-08-23 13:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-08-23 13:42 -------
(In reply to comment #7)
> A big mistery...
Actually, in 3_4-branch memory allocation in class hashtable was rather different,
forgot about that. The bug is there.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
` (7 preceding siblings ...)
2005-08-23 13:43 ` pcarlini at suse dot de
@ 2005-08-23 13:55 ` pinskia at gcc dot gnu dot org
2005-08-23 14:16 ` pcarlini at suse dot de
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-23 13:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-23 13:42 -------
Oh and the preprocessed created with 3.4.0 gives the same error on the mainline too.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
` (8 preceding siblings ...)
2005-08-23 13:55 ` pinskia at gcc dot gnu dot org
@ 2005-08-23 14:16 ` pcarlini at suse dot de
2005-08-23 17:25 ` mattias dot ellert at tsl dot uu dot se
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pcarlini at suse dot de @ 2005-08-23 14:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-08-23 13:55 -------
It looks like the problem has been fixed in revision 1.6 of hashtable.h.
Mattias, can you experiment a bit with just changing in class hashtable:
typedef _Alloc allocator_type;
to
typedef typename _Alloc::template rebind<value_type>::other allocator_type;
(likely, you have available code using hash_map much more complex than I do)
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
` (9 preceding siblings ...)
2005-08-23 14:16 ` pcarlini at suse dot de
@ 2005-08-23 17:25 ` mattias dot ellert at tsl dot uu dot se
2005-08-23 18:28 ` pcarlini at suse dot de
2005-08-29 22:21 ` pcarlini at suse dot de
12 siblings, 0 replies; 14+ messages in thread
From: mattias dot ellert at tsl dot uu dot se @ 2005-08-23 17:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mattias dot ellert at tsl dot uu dot se 2005-08-23 17:14 -------
(In reply to comment #10)
Your proposed alternative patch works for me. Both for the testcase in this bug
report and when I compile the code I was building when I found the bug.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
` (10 preceding siblings ...)
2005-08-23 17:25 ` mattias dot ellert at tsl dot uu dot se
@ 2005-08-23 18:28 ` pcarlini at suse dot de
2005-08-29 22:21 ` pcarlini at suse dot de
12 siblings, 0 replies; 14+ messages in thread
From: pcarlini at suse dot de @ 2005-08-23 18:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-08-23 18:23 -------
(In reply to comment #11)
Thanks a lot. I think adding a proper rebind is the right way to fix the problem,
already used in mainline and 4_0-branch, by the way.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pcarlini at suse dot de
|dot org |
Status|WAITING |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libstdc++/23528] [3.4 Regression] Wrong default allocator in ext/hash_map
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
` (11 preceding siblings ...)
2005-08-23 18:28 ` pcarlini at suse dot de
@ 2005-08-29 22:21 ` pcarlini at suse dot de
12 siblings, 0 replies; 14+ messages in thread
From: pcarlini at suse dot de @ 2005-08-29 22:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-08-29 22:14 -------
Fixed with:
2005-08-29 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/23528
Port from HEAD/4_0-branch:
2004-07-28 Matt Austern <austern@apple.com>
* include/ext/hashtable.h: Use rebind so that allocator_type
has correct type for a container's allocator.
* testsuite/ext/23528.cc: New.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23528
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2005-08-29 22:14 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-23 12:01 [Bug libstdc++/23528] New: Wrong default allocator in ext/hash_map mattias dot ellert at tsl dot uu dot se
2005-08-23 12:02 ` [Bug libstdc++/23528] " mattias dot ellert at tsl dot uu dot se
2005-08-23 12:27 ` mattias dot ellert at tsl dot uu dot se
2005-08-23 12:45 ` [Bug libstdc++/23528] [3.4 Regression] " pinskia at gcc dot gnu dot org
2005-08-23 13:16 ` pcarlini at suse dot de
2005-08-23 13:26 ` pinskia at gcc dot gnu dot org
2005-08-23 13:35 ` pcarlini at suse dot de
2005-08-23 13:42 ` pcarlini at suse dot de
2005-08-23 13:43 ` pcarlini at suse dot de
2005-08-23 13:55 ` pinskia at gcc dot gnu dot org
2005-08-23 14:16 ` pcarlini at suse dot de
2005-08-23 17:25 ` mattias dot ellert at tsl dot uu dot se
2005-08-23 18:28 ` pcarlini at suse dot de
2005-08-29 22:21 ` pcarlini at suse dot de
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).