www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/03/02:58:12

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ERROR 0004
Date: 3 Mar 1997 05:35:29 GMT
Organization: The National Capital FreeNet
Lines: 37
Message-ID: <5fdnv1$nc0@freenet-news.carleton.ca>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970302125818 DOT 6609A-100000 AT is>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet2.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii (eliz AT is DOT elta DOT co DOT il) writes:
> On Thu, 27 Feb 1997, Mark T Logan wrote:
> 
>> I looked all over the DJGPP docs, but I couldn't find
>> any error number listings.  My program is crashing
>> with a page fault, and error 0004.  What is error 0004?
> 
> Please post a complete traceback printed when the program crashes.  It
> is very hard to answer your question otherwise.


0004 is general protection fault.

* Array access out of bounds
* Malloc access out of bounds
* Null pointer usage (see below)
* Pointer used before initialized
* Pointer from a malloc used before checking for NULL (but NULL from
  malloc is very rare if you have reasonable RAM and free disk, under GCC!)


below:

void main (void) {
  int a;
  a= *((int *)0);
}

This will cause a GPF.
Beware dereferencing NULL!

--
    .*.  Where feelings are concerned, answers are rarely simple [GeneDeWeese]
 -()  <  When I go to the theater, I always go straight to the "bag and mix"
    `*'  bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh

- Raw text -


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