Mail Archives: djgpp/1996/04/26/16:06:56
On Fri, 26 Apr 1996, Eli Zaretskii wrote:
>
> On Thu, 25 Apr 1996, Jag wrote:
>
> > They are static variables, declared outside function. I tried enlarging
> > the stack to 2megs and it still did the same thing.
>
> Then the stack is not related to your problem. Please post the minimum
> code fragment that is required to see what you are doing, and the exact
> error message that is printed when the program crashes. Did you check
> that you don't read more data than the length of the arrays?
>
Here is the funny part. If I create an extra array BEFORE the array I
get the error from, then it works. I checked the size several times, but
it does not explain why the same size array works with the extra array,
but not without it. I don't use the extra array. I just put it there as
padding.
Here is the error message:
Page fault at eip=00009985, error=0006
eax=00000000 ebx=00004000 ecx=00001000 edx=00000000 esi=00015280 edi=00000000
ebp=002297a4 esp=00229794 cs=00a7 ds=00bf es=00af fs=008f gs=00bf ss=00af
Call frame traceback EIPs:
0x00009985 ___dj_movedata+33
0x00007f3e ___dosmemget+30
0x00005bf5 __read+197
0x00004b66 _fread_t2+54, line 6137 of towers2.c
0x00002308 _main+584, line 177 of towers2.c
0x000054ab ___crt1_startup+115
-----------------------------------------------------
The same thing happens if I use fread/fopen instead of _read/_open.
-----------------
... /* other arrays before (appx 1 meg )*/
int map[8130], table[5310], table2[1440];
... /* other arrays after (appx 1meg) */
...
fread_t2( &map[0], "map.dat", 32500);
fread_t2( &table[0], "table.dat", 21200);<- error occurs here (line 177)
fread_t2( &table2[0], "table2.dat", 5716);
-----------------
... /* other arrays before (appx 1 meg )*/
int map[8130], table[5310], table2[1440];
... /* other arrays after (appx 1meg) */
...
fread_t2( &map[0], "map.dat", 32500);
/* fread_t2( &table[0], "table.dat", 21200); */
fread_t2( &table2[0], "table2.dat", 5716);
If I remark the fread_t2() then it works. No other fread()s fail.
------------------------
... /* other arrays before (appx 1 meg )*/
int map[8130], dummy_table[5310], table[5310], table2[1440];
... /* other arrays after (appx 1meg) */
...
fread_t2( &map[0], "map.dat", 32500);
fread_t2( &table[0], "table.dat", 21200);
fread_t2( &table2[0], "table2.dat", 5716);
If I add a dummy array, then all the fread()s work.
-----------------------------------
Thanks for your help,
Vince
- Raw text -