public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/5492: basic_string seems to fail to use template-defined allocator.
@ 2002-04-19 13:36 Benjamin Kosnik
0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Kosnik @ 2002-04-19 13:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/5492; it has been noted by GNATS.
From: Benjamin Kosnik <bkoz@redhat.com>
To: Phil Edwards <phil@jaj.com>
Cc: gcc-gnats@gcc.gnu.org, carlo@alinoe.com, kk71878@hotmail.com,
gcc-bugs@gcc.gnu.org
Subject: Re: libstdc++/5492: basic_string seems to fail to use template-defined allocator.
Date: Fri, 19 Apr 2002 13:31:27 -0700
Oh! I did some work on this and then never put it in the PR. It would be
great if you could take over this phil. I'll add in the notes later
today, but POST++ is allocating the string contents on the heap, so they
are not being saved in the persistent object.
I have a smaller example. I don't think this is a library bug anymore,
but a post++ bug.
More details later
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/5492: basic_string seems to fail to use template-defined allocator.
@ 2002-05-31 18:36 pme
0 siblings, 0 replies; 7+ messages in thread
From: pme @ 2002-05-31 18:36 UTC (permalink / raw)
To: carlo, gcc-bugs, gcc-prs, kk71878, nobody
Synopsis: basic_string seems to fail to use template-defined allocator.
State-Changed-From-To: feedback->closed
State-Changed-By: pme
State-Changed-When: Fri May 31 18:09:02 2002
State-Changed-Why:
Not a bug. See audit trail for analysis. (POST++ is
calling malloc directly instead of using the allocator.)
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5492
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/5492: basic_string seems to fail to use template-defined allocator.
@ 2002-04-20 16:55 bkoz
0 siblings, 0 replies; 7+ messages in thread
From: bkoz @ 2002-04-20 16:55 UTC (permalink / raw)
To: carlo, gcc-bugs, gcc-prs, kk71878, nobody
Synopsis: basic_string seems to fail to use template-defined allocator.
State-Changed-From-To: analyzed->feedback
State-Changed-By: bkoz
State-Changed-When: Sat Apr 20 16:55:25 2002
State-Changed-Why:
I don't think this is a bug.
Here's a testcase:
#include "post_stl.h"
#include <iostream>
#include <sstream>
#include <vector>
#include <exception>
#include <stdio.h>
using namespace std;
storage* sto;
struct A
{
pstring msg;
double num;
short pad[5];
A(const char* s, streamsize len, double d) : msg(s, len), num(d) { }
virtual
~A() { }
virtual string
getInfo()
{
ostringstream out;
out << "class type 'A'" << endl;
out << "msg object address = " << (void*)(&msg) << endl;
out << "msg data address = " << (void*)(msg.data()) << endl;
out << "msg = '" << msg.c_str() << "'" << endl;
out << "num = '" << num << "'" << endl;
return out.str();
}
};
typedef vector<A*, post_alloc<A*> > A_vector;
int main()
{
sto = new storage("stringtest.odb");
if (sto->open(storage::fixed))
{
A_vector *root = (A_vector*)sto->get_root_object();
if (root != NULL)
{
cout << "Existing database found at " << root << endl;
for (A_vector::iterator i = root->begin(); i != root->end(); i++)
{
cout << "object found at " << *i << ":" << endl;
cout << (*i)->getInfo();
}
}
else
{
root = new (*sto) A_vector;
cout << "Creating database at " << root << endl;
sto->set_root_object((object*)root);
}
cout << endl;
cout << "Add some lines. Terminate input with empty line." << endl;
while (cin.good())
{
char buf[256];
cin.getline(buf, 256);
streamsize len = cin.gcount() - 1;
if (!len)
{
cout << "done." << endl;
sto->flush();
sto->close();
return EXIT_SUCCESS;
}
else
{
A* a = new (*sto) A(buf, len, 44.5);
cout << "created new A object at " << a << endl;
cout << a->getInfo() << endl;
root->push_back(a);
}
}
}
else
{
cerr << "Failed to open storage" << endl;
return EXIT_FAILURE;
}
}
Gives:
%a.out
Creating database at 0x400005ac
Add some lines. Terminate input with empty line.
this is a test
created new A object at 0x4000060c
class type 'A'
msg object address = 0x40000610
msg data address = 0x81344dc
msg = 'this is a test'
num = '44.5'
And then re-running the binary:
%a.out
Existing database found at 0x400005ac
object found at 0x4000060c:
class type 'A'
msg object address = 0x40000610
msg data address = 0x81344dc
msg = ''
num = '44.5'
It looks like
1) find_storage in storage.h, line 248
has problems finding a block for std::string because sizeof(string) != sizeof(string) + sizeof(string::_Rep)
2) allocate, post_stl.h line 92:
ends up using malloc to get storage.
The results are obvious from the above output.
I think this is an error with the POST++ allocation strategy, or else I'm not configuring it to work correctly.
Thoughts?
-benjamin
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5492
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/5492: basic_string seems to fail to use template-defined allocator.
@ 2002-04-19 13:06 Phil Edwards
0 siblings, 0 replies; 7+ messages in thread
From: Phil Edwards @ 2002-04-19 13:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/5492; it has been noted by GNATS.
From: Phil Edwards <phil@jaj.com>
To: gcc-gnats@gcc.gnu.org
Cc: bkoz@redhat.com, carlo@alinoe.com, kk71878@hotmail.com,
gcc-bugs@gcc.gnu.org
Subject: Re: libstdc++/5492: basic_string seems to fail to use template-defined allocator.
Date: Fri, 19 Apr 2002 16:01:03 -0400
The two files attached to the audit trail aren't self-contained. So I
downloaded post-1.35, and the file stltest.cxx compiles fine for me using
3.1 prerelease. It runs without printing any error messages. There aren't
any instructions on what exactly I'm supposed to look for to tell whether
it's working, so I don't know whether it works or not.
It creates a file called "teststl.odb" but then doesn't do anything with it.
None of the other binaries built during installation do anything with
it either.
Phil
--
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace. We seek
not your counsel, nor your arms. Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen. - Samuel Adams
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/5492: basic_string seems to fail to use template-defined allocator
@ 2002-04-04 19:46 Kevin Killingsworth
0 siblings, 0 replies; 7+ messages in thread
From: Kevin Killingsworth @ 2002-04-04 19:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/5492; it has been noted by GNATS.
From: "Kevin Killingsworth" <kk71878@hotmail.com>
To: bkoz@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, kk71878@hotmail.com, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: libstdc++/5492: basic_string seems to fail to use template-defined allocator
Date: Thu, 04 Apr 2002 21:45:49 -0600
Benjamin,
I checked out what Carlo suggested and couldn't find anything wrong with the
allocator the first time around. I can do some further analysis possibly
this weekend. How much time before the release?
--Kevin
>From: bkoz@gcc.gnu.org
>Reply-To: bkoz@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
>kk71878@hotmail.com, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
>To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, kk71878@hotmail.com,
>nobody@gcc.gnu.org
>Subject: Re: libstdc++/5492: basic_string seems to fail to use
>template-defined allocator.
>Date: 4 Apr 2002 19:51:05 -0000
>
>Synopsis: basic_string seems to fail to use template-defined allocator.
>
>State-Changed-From-To: feedback->analyzed
>State-Changed-By: bkoz
>State-Changed-When: Thu Apr 4 11:51:05 2002
>State-Changed-Why:
> I would like to get resolution on this before gcc-3.1 ships.
>
> To do this, it looks like somebody will have to download post-1.35,
>and the file stltest.cxx and run it, try to find out where it breaks.
>
> -benjamin
>
>http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5492
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/5492: basic_string seems to fail to use template-defined allocator.
@ 2002-04-04 11:51 bkoz
0 siblings, 0 replies; 7+ messages in thread
From: bkoz @ 2002-04-04 11:51 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, kk71878, nobody
Synopsis: basic_string seems to fail to use template-defined allocator.
State-Changed-From-To: feedback->analyzed
State-Changed-By: bkoz
State-Changed-When: Thu Apr 4 11:51:05 2002
State-Changed-Why:
I would like to get resolution on this before gcc-3.1 ships.
To do this, it looks like somebody will have to download post-1.35, and the file stltest.cxx and run it, try to find out where it breaks.
-benjamin
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5492
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: libstdc++/5492: basic_string seems to fail to use template-defined allocator.
@ 2002-01-27 10:15 rodrigc
0 siblings, 0 replies; 7+ messages in thread
From: rodrigc @ 2002-01-27 10:15 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, kk71878, nobody
Synopsis: basic_string seems to fail to use template-defined allocator.
State-Changed-From-To: open->feedback
State-Changed-By: rodrigc
State-Changed-When: Sun Jan 27 10:15:16 2002
State-Changed-Why:
Can you follow the steps outlined in http://gcc.gnu.org/bugs.html
and submit a testcase, preferably preprocessed source?
It is a bit too difficult to try to reproduce the
problem which you describe in the PR without going through
a lot of steps.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5492
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-06-01 1:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-19 13:36 libstdc++/5492: basic_string seems to fail to use template-defined allocator Benjamin Kosnik
-- strict thread matches above, loose matches on Subject: below --
2002-05-31 18:36 pme
2002-04-20 16:55 bkoz
2002-04-19 13:06 Phil Edwards
2002-04-04 19:46 Kevin Killingsworth
2002-04-04 11:51 bkoz
2002-01-27 10:15 rodrigc
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).