public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22609] New: delete [] called on base virtual destructor class [Segmentation failed]
@ 2005-07-22 13:24 sylwekbala at poczta dot onet dot pl
2005-07-22 13:37 ` [Bug c++/22609] " bangerth at dealii dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: sylwekbala at poczta dot onet dot pl @ 2005-07-22 13:24 UTC (permalink / raw)
To: gcc-bugs
version of GCC: 4.0.0
system type: RedHat 8.0
options given when GCC was configured/built:
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/data/gcc/gcc-4.0.0 --exec-
prefix=/data/gcc/gcc-4.0.0
Thread model: posix
gcc version 4.0.0
complete command line that triggers the bug:
g++ Main.cpp -o test
chmod u+x ./test
./test
compiler output (error messages, warnings, etc.): no warnings and messages
Microsoft Visual C++ 7.2 works well with such a source code.
The code of Main.cpp file as below:
#include <stdio.h>
class BaseVector
{
public:
BaseVector() {}
virtual ~BaseVector() {}
};
class Vector : public BaseVector
{
public:
Vector() : BaseVector()
{}
virtual ~Vector() {}
private:
float theValue[3];
};
int main(
int aNoArgs,
const char* aArgs[])
{
BaseVector* v = new Vector[10];
delete [] v; // <----- Here it is crashed
return 0;
}
--
Summary: delete [] called on base virtual destructor class
[Segmentation failed]
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sylwekbala at poczta dot onet dot pl
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22609
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/22609] delete [] called on base virtual destructor class [Segmentation failed]
2005-07-22 13:24 [Bug c++/22609] New: delete [] called on base virtual destructor class [Segmentation failed] sylwekbala at poczta dot onet dot pl
@ 2005-07-22 13:37 ` bangerth at dealii dot org
2005-07-29 11:48 ` pinskia at gcc dot gnu dot org
2005-07-29 11:58 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2005-07-22 13:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2005-07-22 13:24 -------
You can't do this:
BaseVector* v = new Vector[10];
delete [] v; // <----- Here it is crashed
The type of the data allocated is Vector*, which is what you have
to use when you deallocate it. However, in your call to delete[] you
use BaseVector*.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22609
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/22609] delete [] called on base virtual destructor class [Segmentation failed]
2005-07-22 13:24 [Bug c++/22609] New: delete [] called on base virtual destructor class [Segmentation failed] sylwekbala at poczta dot onet dot pl
2005-07-22 13:37 ` [Bug c++/22609] " bangerth at dealii dot org
@ 2005-07-29 11:48 ` pinskia at gcc dot gnu dot org
2005-07-29 11:58 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-29 11:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-29 11:47 -------
*** Bug 23132 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |jorik dot dewit at gmail dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22609
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/22609] delete [] called on base virtual destructor class [Segmentation failed]
2005-07-22 13:24 [Bug c++/22609] New: delete [] called on base virtual destructor class [Segmentation failed] sylwekbala at poczta dot onet dot pl
2005-07-22 13:37 ` [Bug c++/22609] " bangerth at dealii dot org
2005-07-29 11:48 ` pinskia at gcc dot gnu dot org
@ 2005-07-29 11:58 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-29 11:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-29 11:49 -------
*** Bug 15050 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |bracken at ansoft dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22609
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-07-29 11:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-22 13:24 [Bug c++/22609] New: delete [] called on base virtual destructor class [Segmentation failed] sylwekbala at poczta dot onet dot pl
2005-07-22 13:37 ` [Bug c++/22609] " bangerth at dealii dot org
2005-07-29 11:48 ` pinskia at gcc dot gnu dot org
2005-07-29 11:58 ` pinskia at gcc dot gnu dot org
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).