public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23132] New: Array delete'd through base class causes access violation in prog
@ 2005-07-29 11:28 jorik dot dewit at gmail dot com
  2005-07-29 11:47 ` [Bug c++/23132] " pinskia at gcc dot gnu dot org
  2005-07-29 12:38 ` jorik dot dewit at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: jorik dot dewit at gmail dot com @ 2005-07-29 11:28 UTC (permalink / raw)
  To: gcc-bugs

When an array of derived objects is deleted through its base class, the 
resulting program seg faults. Could this be caused by destructor iteration with 
invalid <this> pointers?

Reproduced on gcc (GCC) 3.3.3 (cygwin special), egcs-2.91.66 (red hat 6.2), g++ 
(GCC) 3.3 20030304 (Apple Computer, Inc. build 1495), etc

Keylines in the reproducible case below:
Component* c = new Component1[2];
delete [] c;

Reproducible case:
extern "C" int printf(const char *, ...);

class Component{
public:
	Component();
	virtual ~Component();
};
Component::Component() { /*printf("Component::Component 0x%x\n",this);*/}
Component::~Component() { /*printf("Component::~Component 0x%x\n",this); */}

class Component1 : public Component {
private:
	char bytes1[12];
public:
	Component1();
	virtual ~Component1();
};
Component1::Component1() { /*printf("Component1::Component1 0x%x\n",this);*/}
Component1::~Component1() { /*printf("Component1::~Component1 0x%x\n",this);*/ }

int main() 
{
	Component* c = new Component1[2];
	delete [] c;
	
	return 0;
}

-- 
           Summary: Array delete'd through base class causes access
                    violation in prog
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jorik dot dewit at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-cygwin i686-pc-linux ppc-mac-osx


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23132


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/23132] Array delete'd through base class causes access violation in prog
  2005-07-29 11:28 [Bug c++/23132] New: Array delete'd through base class causes access violation in prog jorik dot dewit at gmail dot com
@ 2005-07-29 11:47 ` pinskia at gcc dot gnu dot org
  2005-07-29 12:38 ` jorik dot dewit at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-29 11:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-29 11:47 -------


*** This bug has been marked as a duplicate of 22609 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23132


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/23132] Array delete'd through base class causes access violation in prog
  2005-07-29 11:28 [Bug c++/23132] New: Array delete'd through base class causes access violation in prog jorik dot dewit at gmail dot com
  2005-07-29 11:47 ` [Bug c++/23132] " pinskia at gcc dot gnu dot org
@ 2005-07-29 12:38 ` jorik dot dewit at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jorik dot dewit at gmail dot com @ 2005-07-29 12:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jorik dot dewit at gmail dot com  2005-07-29 12:29 -------
(In reply to comment #1)
> *** This bug has been marked as a duplicate of 22609 ***

Sorry about reporting a duplicate. I had looked/searched. Maybe the default 
settings for the query form should include issues with status RESOLVED (but 
with resolution <> FIXED; i.e. especially INVALID  (and WONTFIX/DUPLICATE).
Maybe this would avoid some duplicate bug reports?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23132


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-07-29 12:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-29 11:28 [Bug c++/23132] New: Array delete'd through base class causes access violation in prog jorik dot dewit at gmail dot com
2005-07-29 11:47 ` [Bug c++/23132] " pinskia at gcc dot gnu dot org
2005-07-29 12:38 ` jorik dot dewit at gmail dot com

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).