| delorie.com/archives/browse.cgi | search |
| From: | ryot AT bigfoot DOT com (George Ryot) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: a K-R program doesn't work only with DJGPP |
| Message-ID: | <3815f2df.20207061@news.clara.net> |
| References: | <7uq3tl$i53$1 AT fe2 DOT cs DOT interbusiness DOT it> |
| X-Newsreader: | Forte Agent 1.5/32.452 |
| X-No-Archive: | yes |
| MIME-Version: | 1.0 |
| Lines: | 60 |
| Date: | Fri, 22 Oct 1999 23:30:45 GMT |
| NNTP-Posting-Host: | 195.8.91.131 |
| X-Complaints-To: | abuse AT clara DOT net |
| X-Trace: | nnrp4.clara.net 940635045 195.8.91.131 (Sat, 23 Oct 1999 00:30:45 BST) |
| NNTP-Posting-Date: | Sat, 23 Oct 1999 00:30:45 BST |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
"Bonifati" <abonifati AT telsa DOT it> wrote:
> so why it crashes? i bet it's a compiler bug, but i'm not able to locate it.
The way to find out is to simplify the program to the smallest that
will still exhibit the problem:
/*** bug.c ***/
int main(void)
{
return 0;
}
void qsort(int *v)
{
v[30000] = 0;
}
C:\gccbug>del a.*
C:\gccbug>gcc -g bug.c
C:\gccbug>a
C:\gccbug>a b
Exiting due to signal SIGSEGV
General Protection Fault at eip=00001577
eax=000a9668 ebx=00000000 ecx=00000008 edx=0000bdf4 esi=0008bdac
edi=0008c158
ebp=0008b59c esp=0008b59c program=C:\GCCBUG\A.EXE
cs: sel=00a7 base=831d7000 limit=0009ffff
ds: sel=00af base=831d7000 limit=0009ffff
es: sel=00af base=831d7000 limit=0009ffff
fs: sel=0087 base=00014fa0 limit=0000ffff
gs: sel=00bf base=00000000 limit=0010ffff
ss: sel=00af base=831d7000 limit=0009ffff
App stack: [0008bee8..0000bee8] Exceptn stack: [0000bdcc..00009e8c]
Call frame traceback EIPs:
0x00001577 _qsort+11, line 10 of bug.c
0x00007cab ___glob+475
0x00006db3 ___crt0_glob_function+23
0x00005a22 ___crt0_load_environment_file+3090
0x00005f51 ___crt0_setup_arguments+1297
0x000028dd ___crt1_startup+101
C:\gccbug>symify a.exe
The DJGPP startup code calls the globbing function which in turn calls
qsort which has been redefined to do something bad.
Whether this is a program or compiler bug hinges on whether or not it
is legal to have user defined functions which overide those in libc.
I am fairly sure that it is, and so this is indeed a DJGPP bug.
--
george
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |