home *** CD-ROM | disk | FTP | other *** search
- #if 0
- From:
- Subject:
- Status: Works for me on ZTC++ 2.18
- #endif
-
- #if 0
- From uunet.uu.net!xanadu!ravi Fri Jan 18 04:21:27 1991
- Received: from proto by nazgul.UUCP id aa05667; Fri, 18 Jan 91 4:21:15 GMT
- Received: from zortech by proto.COM id aa02167; Thu, 17 Jan 91 19:21:59 PST
- Received: from proto by zortech.UUCP id aa22535; Thu, 17 Jan 91 21:21:19 EST
- Received: from uunet by proto.COM id aa02044; Thu, 17 Jan 91 17:22:18 PST
- Received: from xanadu.UUCP by uunet.UU.NET (5.61/1.14) with UUCP
- id AA04987; Thu, 17 Jan 91 17:10:48 -0500
- Received: by xanadu (4.1/SMI-4.0.2) id AA19943; Thu, 17 Jan 91 14:11:14 PST
- Date: Thu, 17 Jan 91 14:11:14 PST
- From: Ravi Pandya <xanadu!ravi@uunet.uu.net>
- Message-Id: <9101172211.AA19943@xanadu >
- To: zortech-bugs@proto.com
- Subject: DOS386 C++ 2.18 setjmp problem
- Status: RO
-
- This is an easy problem to fix, but it is insidious and very
- dangerous. The jmp_buf type is not being declared sufficiently large
- to hold the information that the 386 library routine puts into it,
- causing it to overwrite whatever comes next in memory. It can be fixed
- by adding "-DM_I386" to the CFLAGS environment variable. Here's a
- piece of code that causes the error.
- --ravi
-
- Ravi Pandya
- Xanadu Operating Company
- 550 California Avenue
- Suite 101
- Palo Alto, CA 94306
- 415 856 4112 ext 122
- 415 856 2251 fax
- ravi@xanadu.com
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- compile with ztc -3 -O setjmp.c
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #endif
-
- #include <setjmp.h>
- #include <stdio.h>
-
- void main (int argc, char * argv[]) {
- struct {
- jmp_buf jump;
- int stomp;
- } foo;
-
- foo.stomp = 666;
- setjmp (foo.jump);
- printf ("stomp changed to %d from 666\n", foo.stomp);
- }
-