www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/15/05:37:14

Date: Thu, 15 Oct 1998 12:36:00 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: John Furlong <jfurlong AT worldhq DOT com>
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: <Pine.SUN.3.91.981015123532.15214E-100000@is>
MIME-Version: 1.0
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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019