Bug#105384: Segfault involving templates, std::string, and exceptions
Package: g++-3.0
Version: 1:3.0-4
Severity: normal
Consider the attached source file. When trying to compile this, I get:
| srittau@jroger:~$ g++-3.0 -O -c segfault.cc
| g++-3.0: Internal error: Segmentation fault (program as)
| Please submit a full bug report.
| See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
| For Debian GNU/Linux specific bugs,
| please see /usr/share/doc/debian/bug-reporting.txt.
|
| srittau@jroger:~$
Removing the -O switch fixes this as well as tweaking the source file
a little here or there. When I try to compile this on a SuSE 7.1 box
(i386 as well) with a hand-installed g++ 3.0, everything works fine.
I also doubt that this is a hardware problem, since I have no problems
compiling anything else and the problem is quite reproducible.
-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux jroger 2.4.5 #1 Sam Mai 26 15:18:03 CEST 2001 i686
Locale: LANG=de_DE.ISO8859-1, LC_CTYPE=de_DE.ISO8859-1
Versions of packages g++-3.0 depends on:
ii gcc-3.0 1:3.0-4 The GNU C compiler.
ii gcc-3.0-base 1:3.0-4 The GNU compiler collection (base
ii libc6 2.2.3-6 GNU C Library: Shared libraries an
ii libstdc++3-dev 1:3.0-4 The GNU stdc++ library version 3 (
#include <string>
class _Exception
{
public:
~_Exception();
};
class C {
public:
void Method();
};
C *Func(const std::string &);
template<class T, class L>
class Template {
public:
void a() {
Func("");
}
void b() throw(_Exception) {
C *c = Func("");
c->Method();
throw _Exception();
}
};
template class Template<int, int>;
Reply to: