This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Bug or WAD?
- To: <egcs at cygnus dot com>
- Subject: Bug or WAD?
- From: Leo Comitale <comitale at ca dot ibm dot com>
- Date: Tue, 24 Nov 1998 11:49:42 -0500
Hi,
In our work porting software to Linux (Redhat 5.2, using egcs RPM 1.02-12) we
have come across an interesting disparity between the behaviour of egcs and of
other compilers on other platforms.
We have some code which looks something like this small demonstration program:
--
class cl
{
public:
int a;
void * operator new(unsigned long size)
{ return (void *) 0; };
cl(int b) { a = b; };
};
int main(void)
{
class cl *c;
c = new cl(6);
printf("does it make it to here?\n");
return 0;
}
--
Instead of just returning NULL, our code uses a malloc-like call to allocate
storage for the new object. In one of our testcases this call is forced to
fail returning NULL to simulate an out-of-memory situation. On most platforms
(including AIX, Solaris, HP-UX, Windows NT, OS/2, etc) this does NOT result in
a catastrophic error. However on Linux using egcs, it seems the object
constructor is still being called and the program dies with a memory access
violation.
Can anyone tell me if this is "working as designed" or perhaps this is a small
bug?
Please copy my email address if you reply, thanks.
______________________________________________________
Leo Comitale
DB2 Workstation Engine Development, IBM Canada
416-448-4239, Tie Line: 778-4239
comitale@ca.ibm.com