From: "Luke Bishop" Newsgroups: comp.os.msdos.djgpp Subject: Re: GCC Bug (HELP ME!!!!!) Date: 8 Mar 1998 01:45:18 GMT Organization: The Zone Lines: 43 Message-ID: <01bd497a$b53921e0$4248a5c6@technoid> References: <01bd4887$162bdc80$7348a5c6 AT technoid> <35019CDA DOT 6805 AT cam DOT org> NNTP-Posting-Host: n072h066.thezone.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk > It doesn't. I don't want to spoil the fun of founding a bug in GCC, but > your source (with an #include added to it) compiles fine and > does not crash... It's more subtle than that. In fact, here is the REAL debugging code I used to find this bug myself: #include #include class mytestvar { public: virtual void testfn() { } void* operator new(size_t me) { printf("The new me...\n"); printf("%ld\n",me); return NULL; } mytestvar() { printf("Constructed...\n"); printf("%ld\n",this); } }; extern long something __asm__("__vt$9mytestvar"); main() { printf("%ld\n",*(long*)NULL); mytestvar* c=new mytestvar; printf("%ld\n",(long)c); printf("%ld\n",*(long*)c); printf("%ld\n",&something); } It will not crash, but it DOES change the value at NULL. I think that this still counts as a bug, as the default NEW operator dereferences a NULL pointer. Also, the fact that the default NEW operator will dump if it runs out of memory is a deviation from the ANSI C++ spec anyway.