public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* ada/9273: g++ 3.2 generates segmentation fault for correct code
@ 2003-01-11 8:06 john.ahlgren
0 siblings, 0 replies; 2+ messages in thread
From: john.ahlgren @ 2003-01-11 8:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 9273
>Category: ada
>Synopsis: g++ 3.2 generates segmentation fault for correct code
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Sat Jan 11 00:06:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: John Ahlgren
>Release: gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
>Organization:
>Environment:
x386, Redhat 8.0 with Linux kernel 2.4.18-19.8.0
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
>Description:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class A {
public:
A(string s) { sptr = new string; }
~A(void) { cerr << "delete " << sptr << "\n"; delete sptr; cerr << "delete done\n"; }
private:
string* sptr;
};
int main()
{
vector<A> avec;
A a("a");
avec.push_back(a);
avec.push_back(a);
cerr << "main done\n";
}
>How-To-Repeat:
Compile with g++ -Wall file -o test (no warnings are output)
Then just run it, it will segfault trying to delete the pointer A::sptr
Is this really a bug?
>Fix:
Unfortunately, I have no idea :-(
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ada/9273: g++ 3.2 generates segmentation fault for correct code
@ 2003-01-11 8:56 John Ahlgren
0 siblings, 0 replies; 2+ messages in thread
From: John Ahlgren @ 2003-01-11 8:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR ada/9273; it has been noted by GNATS.
>From john.ahlgren@home.se Mon Jan 13 00:57:20 2003
From: John Ahlgren <john.ahlgren@home.se>
To: gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: ada/9273: g++ 3.2 generates segmentation fault for correct code
Date: 11 Jan 2003 09:50:32 +0100
Hi,
I'm sorry about my bug report; it is invalid.
I made the assumption that no object of A was copied, but that
was the case. So, may I now bother you asking why it is copied:
class A { ... };
A a;
vector<A> avec;
// avec.reserve(2) (*)
avec.push_back(a);
avec.push_back(a);
With (*) of course nothing is copied, but even so, can't realloc() be
used instead?
Cheers,
John
On Sat, 2003-01-11 at 09:06, gcc-gnats@gcc.gnu.org wrote:
> Thank you very much for your problem report.
> It has the internal identification `ada/9273'.
> The individual assigned to look at your
> report is: unassigned.
>
> >Category: ada
> >Responsible: unassigned
> >Synopsis: g++ 3.2 generates segmentation fault for correct code
> >Arrival-Date: Sat Jan 11 00:06:00 PST 2003
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-01-11 8:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-11 8:06 ada/9273: g++ 3.2 generates segmentation fault for correct code john.ahlgren
2003-01-11 8:56 John Ahlgren
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).