www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/12/07:45:27

Date: Fri, 12 Feb 1999 13:43:50 +0100
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Message-Id: <199902121243.NAA18371@acp3bf.physik.rwth-aachen.de>
To: djgpp AT delorie DOT com
Subject: Re: C - problems
Newsgroups: comp.os.msdos.djgpp
Organization: RWTH Aachen, III. physikalisches Institut B
X-Newsreader: TIN [version 1.2 PL2]
Reply-To: djgpp AT delorie DOT com

In article <000d01be565c$6a6c1240$c510f2d4 AT jakob> you wrote:

> Okay, I spend quite a few hours reading the FAQ-sections and found out =
> lots of things, but my main problem still exists.

Hmmm... seems you have not found or understood section 12.2 about 
'how to begin debugging using the crash dump info'. Or section 15.9,
which explains exactly your problem (although you may lack the
knowledge to see why, from what you say).

So let me point out some of the details:

> C:\dokumenter\mat?k\nummetoder>kap1jh.exe
> Exiting due to signal SIGSEGV
> Stack Fault at eip=000019ad
> eax=00000001 ebx=000082b3 ecx=000004b0 edx=0000d644 =
> esi=00000054 edi=00023d70
> ebp=000a3d50 esp=fffb955c 
               ^^^^^^^^^^^^
This is the first and foremost symptom of the problem: the stack pointer
has wrapped around to a negative value, which means something in your
stack consumed too much space.

> C:\dokumenter\mat=F8k\nummetoder>gcc -Wall -o kap1jh.exe kap1jh.c
> kap1jh.c: In function `printsol':
> kap1jh.c:97: warning: use of `l' length character with `f' type =
> character
[... many more of these...]

While these are not the source of your problem, they are still real
problems in the code. Your program seems to contain many uses of "%lf"
and "%le" in printf() calls, which is incorrect, in a somewhat tricky,
but still important sense. Looks like your teachers code is not all
that perfect, actually :-)

But now to the actual source of the crash:

> main(){

>   int M,N,numprint,nprint[100],i,printcount,k,n;
>   double x0,x1,tend,Dx,Dt,x[10000],t[100000],unew[10000];
                                     ^^^^^^^^^
The marked variable is the culprit. That's a one hundred thousand
element array of doubles, worth 800000 bytes of storage. Too much
for a DJGPP program with default settings. Look up FAQ section 15.9
for more information.

--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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