Mail Archives: cygwin/2002/03/06/22:13:43
Hi, gentleman, could you do me a favour?
I had some trouble in running a C program.
[C source code is]
----- from here ----
#include <stdio.h>
int main() {
char *a = "I am a teacher";
char *b = "You are a student";
printf("string_a = %s\nstring_b = %s\n", a, b);
copy_string(a, b);
printf("string_a = %s\nstring_b = %s\n", a, b);
}
int copy_string(char *from, char *to) {
while((*to++ = *from++) != '\0');
}
----- end here ----
[Compilation Tool]
gcc version 2.95.3-5(cygwin)
[Question]
The compilation is passed, but after running the a.exe, the
following message appeared and I got a a.exe.stackdump too.
------
string_a = I am a teacher
string_b = You are a student
0 [main] a 1536 open stackdumpfile:Dumping stack trace to a.exe
stackdump
Segmentation fault (core dumped)
------
[Misc]
The contents of a.exe.stackdump is the following:
--------
Exception: STATUS_ACCESS_VIOLATION at eip=004010F0
eax=00401049 ebx=00000004 ecx=00401044 edx=00401053 esi=610903E8 edi=00000001
ebp=0240FE84 esp=0240FE84 program=E:\home\Study\C\a.exe
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
0240FE84 004010F0 (00401044, 00401053, 00401053, 0040108F)
0240FEB4 004010C5 (00000001, 1A023684, 0A010008, 00000000)
0240FF10 61003AEA (00000000, 0247E798, F08ABC4C, 00000001)
0240FF40 61003CBD (00401084, 0247E798, FD37F440, 00000000)
0240FF60 61003CFC (00000000, 00000000, FD37F5D0, 00000005)
0240FF90 00401153 (00401084, FFFFFFFF, 80430D77, 00000000)
0240FFC0 0040103D (0247E798, 00000000, 7FFDF000, 0247FA39)
0240FFF0 77E97D08 (00401000, 00000000, 000000C8, 00000100)
End of stack trace
---------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -