home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!emory!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cmu.edu!court+
- From: court+@cmu.edu (Court Demas)
- Newsgroups: gnu.g++.bug
- Subject: Possible "new" bug
- Message-ID: <0f2GQY600Vom8jZ40U@andrew.cmu.edu>
- Date: 17 Nov 92 07:08:52 GMT
- Article-I.D.: andrew.0f2GQY600Vom8jZ40U
- Sender: gnulists@ai.mit.edu
- Distribution: gnu
- Organization: GNUs Not Usenet
- Lines: 26
- Approved: bug-g++@prep.ai.mit.edu
-
- I have been wrestling with what seems to be a bug in g++ v2.2.2. I am first
- assuming that the following two are equivalent:
-
- Footype *f = new Footype();
-
- and
-
- Footype *f;
- f = new Footype();
- But these two fragments produce very different results (this is inside a
- function call). The 1-line version behaves very badly - 'new' seems to
- reallocate a block of memory which was already allocated earlier in the
- application. So, the object gets initialized ok, but it trashes a few other
- objects in the process.
-
- I haven't been able to quantify this yet into a sample program, but I can
- definitely reproduce it in my application (it's 5k and 70 source files).
- I *never* deallocate memory in the application (all delete's are commented out)
- so I can't see why this should happen under any circumstances.
-
- If anybody could provide an insight on this I would greatly appreciate it.
- I will hopefully be able to post a sample program which exhibits the bug soon.
-
-
- thanks,
- court
-