Date: Thu, 15 Oct 1998 12:36:00 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: John Furlong cc: djgpp AT delorie DOT com Subject: Re: Program fails when the size of an array of struct is increased. In-Reply-To: <3624E79B.4A34529@worldhq.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Wed, 14 Oct 1998, John Furlong wrote: > typedef struct { > char product[PRODUCT_LEN]; > int stock ; > int price ; > char bar[BAR]; > int active ; > int quantity ; > char vat_code ; > } SellRecord ; > > When I define an array of this structure I find I can can define an > array of up to 6 and everything runs fine. If I define the array with > a size of anything greater the program fails with this error message :- How large are PRODUCT_LEN and BAR? > Exiting due to signal SIGSEGV > Page fault at eip=00004023, error=0006 Please always post the entire message printed when the program crashes, complete with the full registers' dump, the call frame dump, etc. These seemingly-nonsensical numbers contain crucial info about the reasons of the crash, and people who know how to interpret it can sometimes instantly tell you what's wrong. Also, the DJGPP FAQ list (v2/faq211b.zip from the same place you get DJGPP) explains in section 12.2 how to interpret the crash messages and how to begin debugging your program using the crash dump as a guide. In general, Page Fault with error=0006 means you tried to set a value via a NULL (or a garbled) pointer. > It looks like memory to me, which would explain why it runs > under NT/95 but not dos The Windows DPMI server doesn't catch NULL pointer dereferences, whereas CWSDPMI used under DOS does.