This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13865] dtor runs prematurely for loop-scoped variable
- From: "bryner at brianryner dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jan 2004 06:29:00 -0000
- Subject: [Bug c++/13865] dtor runs prematurely for loop-scoped variable
- References: <20040126062654.13865.bryner@brianryner.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bryner at brianryner dot com 2004-01-26 06:28 -------
Created an attachment (id=5579)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5579&action=view)
testcase
$ c++ -v
Reading specs from /usr/gcc-ssa/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/specs
Configured with: ../gcc/configure --prefix=/usr/gcc-ssa --enable-shared
--enable-threads=posix --disable-checking --with-system-zlib
--enable-__cxa_atexit --enable-languages=c,c++ --host=i686-pc-linux-gnu
Thread model: posix
gcc version 3.5-tree-ssa 20040125 (merged 20040102)
$ c++ -o test_loop test_loop.cpp
$ ./test_loop
A ctor
A dtor
iteration 0
A ctor
A dtor
iteration 1
A ctor
A dtor
expected output:
A ctor
iteration 0
A ctor
A dtor
iteration 1
A ctor
A dtor
A dtor
No optimization flags are needed in order to reproduce this bug.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13865