This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
ada/9273: g++ 3.2 generates segmentation fault for correct code
- From: john dot ahlgren at home dot se
- To: gcc-gnats at gcc dot gnu dot org
- Date: 11 Jan 2003 08:05:39 -0000
- Subject: ada/9273: g++ 3.2 generates segmentation fault for correct code
- Reply-to: john dot ahlgren at home dot se
>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: