Bug#188527: g++-3.2: Stack corruption with variable-length automatic arrays and virtual destructors
Package: g++-3.2
Version: 1:3.2.3-0pre7
Severity: normal
Tags: upstream
Hi,
the following program compiles (compiled as "g++ stackcorrupt.cpp"),
but crashes when run. It seems that the stack gets corrupted with that
variable-length array when A class with a virtual function is used
and the length assigning variable(foo) is being changed.
stackcorrupt.cpp:
--snip--
class A {
public:
virtual ~A() {}
};
int main(void) {
int foo=1;
A bar[foo];
foo++;
return 0;
}
--snip--
The same problem can also be reproduced by using the compiler from the
gcc-snapshot (20030314-1) or with the g++-3.0 (3.0.4-13). The g++-2.95
(2.95.4-17) does not have the same problem.
-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux mario 2.4.19 #2 su elo 18 10:13:17 EEST 2002 i586
Locale: LANG=fi_FI@euro, LC_CTYPE=fi_FI@euro
Versions of packages g++-3.2 depends on:
ii gcc-3.2 1:3.2.3-0pre7 The GNU C compiler
ii gcc-3.2-base 1:3.2.3-0pre7 The GNU Compiler Collection (base
ii libc6 2.3.1-16 GNU C Library: Shared libraries an
ii libstdc++5-dev 1:3.2.3-0pre7 The GNU Standard C++ Library v3 (d
-- no debconf information
--
Toni Timonen
Helsinki University of Technology
Department of Engineering Physics and Mathematics
Reply to: