c++/6052: calls to allocator::~allocator made for empty class
georgeh@aya.yale.edu
georgeh@aya.yale.edu
Mon Mar 25 07:36:00 GMT 2002
>Number: 6052
>Category: c++
>Synopsis: calls to allocator::~allocator made for empty class
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Mon Mar 25 07:36:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: George Heintzelman <georgeh@aya.yale.edu>
>Release: gcc-3.0.4
>Organization:
>Environment:
Solaris 2.8
>Description:
In the following code:
#include <string>
int main() {
for (int i = 0; i < 100000; ++i) {
std::string foo("Hello world");
}
}
g++ generates calls to empty std::allocator::~allocator routines,
as well as empty std::string::Alloc_hider::~Alloc_hider routines,
within the loop.
>How-To-Repeat:
compile with g++ -O3
>Fix:
(sort of) I can get rid of the calls by commenting out
~allocator() __STL_NOTHROW {}
in the standard header stl_alloc.h. So I considered submitting
this as a library bug (and the library probably ought to be
changed)... but the compiler really ought to be able to figure
this out. It's not the __STL_NOTHROW, either, leaving it as
~allocator() {}
also causes the pessimizing behavior.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list