Mail Archives: djgpp/1997/09/23/05:12:04
Can anyone help me with this problem:
When I compile my program as follow:
gcc -Wall program.c -o program.exe
the programs will run in a dos box (WIN 95) and also under
MS-dos 7.0.
But when I compile with:
gcc -O3 -Wall program.c -o program.exe
The program runs also fine under a dos box in Win95, but under
MS-dos 7.0 (NOT a dos box in Win95) I got the next error code:
C:\RICHARD\GUI\bic\BIN>type error.txt
Exiting due to signal SIGSEGV
Page fault at eip=00037da1, error=0006
eax=7ffffffd ebx=00000002 ecx=00000002 edx=00000031 esi=0009034e
edi=00000003
ebp=0008ef84 esp=0008ef78 cs=00e7 ds=00ef es=00ef fs=00ff gs=00ff
ss=00ef
Call frame traceback EIPs:
0x00037da1 ___dj_movedata+37
0x00033dd3 __doprnt+2367
0x0002dd82 _sprintf+42
0x0000855c _start_1+7632
0x000113f4 _start_session+288
0x000022aa _callback+54
0x00004909 _xv_main_loop+2573
0x0000bfa1 _main+4501
0x0002c53f ___crt1_startup+115
C:\RICHARD\GUI\bic\BIN>symify bic.exe
Thus the program crashes when the function sprintf is called.
The part of the source code where this happend is:
#include <stdio.h>
#include <grx20.h>
struct tijd{
int uur;
int minuut;
int seconde;
}
char *dumtxt[10];
tijd abs;
int c_edit=0x07, c_normal=0x05;
...
...
sprintf(*dumtxt,"%02d:%02d:%02d",abs.uur,abs.minuut,abs.seconde);
GrTextXY(GrMaxX()/2-25,25,*dumtxt,c_edit,c_normal);
...
...
Thus under the next cirumstances the function sprintf will crash:
Running in a DOS environment, compiled with -O3.
My questions are, why does it not crash in a dos-box (win95) and why
does it crash at all???
Thanks,
R. Gorkink
Granulab Project B.V.
Amersfoort - The Netherlands
- Raw text -