bug

Maurice Lombardi Maurice.Lombardi at ujf-grenoble.fr
Thu Apr 27 16:09:09 CEST 2000


John Blakeney a écrit :
> 
> I have had similar problems when I used the DJGPP port of GPC, basicaly
> it was due pointer problem that was my fault, but programs ran fine when
> using the non DJGPP ports [just to utterly confuse me].
>     Hope that might be some help
>         John Blakeney

Besides pointers problems, which may be different on different systems due to
the efficiency of that underlying system to catch invalid pointers, there is a
difference between the Compary contained in main and the other contained in the
procedure. The first being global is allocated in the heap, the second is
allocated in the stack, so you may have a problem of stack overflow. The size of
that array 256x256x4x2 = 512 kb is not very large, but you could have problems
with the settings of your W98 / DOS box: look to properties / memory settings.
In pure DOS djgpp you should stubedit your executable to check its stack size
(by default it is only 256k or 512k depending on the version of djgpp and/or gpc
I think), but I am not sure how it is allocated in a W98 DOS Box (stubedit works
in a DOS box but I am not sure if its settings are valid in a W98 dos box or
only apply when the executable is run under CWSDPMI (pure dos)). Anyhow a 512k
setting for stack is not enough in your case. In contrast a global variable can
use all DPMI memory + swap space available (as reported by typing go32-v2 at dos
prompt).
  
> Toby Ewing wrote:
> 
> > Hi, all.
> >
> > I've been fighting a bug for a while, and when I stripped it down to its
> > basics, I was surprised.  My test program is appended.
> >
> > The issue involves arrays of size > 255.  When I use Ymax = Zmax = 250,
> > the program runs fine.  When I use Ymax = Zmax = 260, the portion of the
> > program that runs in Main works fine, but the procedure stops at y = 7,
> > z = 260 - the program hangs, with ^C ineffective.
> >
> > I'm running a pentium 400 under Win98.  I've had no trouble with this in
> > small arrays, but 256 seems to be a divide of some sort.
> >
> > Any suggestions appreciated.
> > Toby
> >
> > Toby Ewing
> > Soil Scientist, Iowa State University
> >
> > -------------------------------------------------------------------
> >
> > Program TestLgArray;
> >
> > Const
> >   Xmax       = 25 ;                    {physical space - grid units}
> >   Ymax       = 260;                    {physical space - grid units}
> >   Zmax       = 260;
> >
> > Type
> >   Compary     = array[1..Ymax, 1..Zmax] of integer;
> >
> > var
> >   Comp        : Compary;
> >   x, y, z     : integer;
> >
> > {________________________________________________
> > }
> > Procedure Zero;
> >
> > var
> >   Comp        : Compary;
> >   x, y, z     : integer;
> >
> > begin
> >   writeln('Procedure:');
> >   readln;
> >   for y := 1 to Ymax do begin                    {zero the comp array}
> >     for z := 1 to Zmax do Comp[y,z] := 0;
> >     writeln('y=', y:3, '  z=', z:1);
> >   end;
> > end;
> > {________________________________________________
> > }
> >
> > begin                                            {Main Program}
> >   writeln('Main:');
> >   readln;
> >   for y := 1 to Ymax do begin                    {zero the comp array}
> >     for z := 1 to Zmax do Comp[y,z] := 0;
> >     writeln('y=', y:3, '  z=', z:1);
> >   end;
> >   Zero;
> >   write(' done');
> > end.


-- 
       Maurice Lombardi
Laboratoire de  Spectrometrie Physique,
Universite Joseph Fourier de Grenoble, BP87
38402 Saint Martin d'Heres Cedex     FRANCE
Tel: 33 (0)4 76 51 47 51
Fax: 33 (0)4 76 51 45 44
mailto:Maurice.Lombardi at ujf-grenoble.fr




More information about the Gpc mailing list