delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/15/09:17:02

Date: 13 Oct 1996 11:25:00 +0200
From: Piotr DOT Kasprzak AT xyz DOT prima DOT ruhr DOT de (Piotr Kasprzak)
Newsgroups: comp.os.msdos.djgpp
Message-ID: <6IlzIonNWSB@xyz.prima.ruhr.de>
Subject: Error in gcc !?
Organization: PRIMA e.V. - Dortmund
Lines: 37
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi all,

I think I encountered a bug in gcc (I'm using DJGPP v2), which drove me  
crazy quite a long time. I've defined a class hierarchie, which is  
similiar to the following (of course it's bigger and more complex, but  
this should be enough to illustrate the problem):

class A {

protected:

        unsigned *Ptr;

...

};

class B : public A {

...

};

Now I made a mistake in the constructor of class B: I referred to Ptr with  
B :: Ptr. But gcc didn't reported the bug and compiled everything. The  
Consequence of this was, that Ptr was internally misaddressed by the  
compiler and every data-write to Ptr went somewhere else overwriting other  
local data of the classes or even the virtual function call mechanisms  
which resulted in calls to nirvana and so on (wasn't that nice ;)). Maybe  
this bug is only due to some wired structures within my program and  
doesn't occure in general (didn't tested that yet), but I just wanted to  
warn you all ....

c-ya,
Piotr
-- 
Piotr DOT Kasprzak AT xyz DOT prima DOT ruhr DOT de                http://www.prima.ruhr.de

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019