Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com From: dietrich-e DOT alker AT wwgsolutions DOT com >Received: from magnus.eni.wago.de by wago.de (SMI-8.6/SMI-SVR4) id PAA06723; Tue, 17 Aug 1999 15:38:56 +0200 X-Lotus-FromDomain: GLOBAL To: cygwin AT sourceware DOT cygnus DOT com Message-ID: Date: Tue, 17 Aug 1999 15:38:47 +0200 Subject: STATUS_ACCESS_VIOLATION in egcs-2.91.57 compiled program Mime-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset=us-ascii Dear cygwin gurus, for porting C programs from UNIX to NT, I downloaded the complete Cygwin B20.1 on 1999-07-29 and installed it under NT 4.0 SP4. The first program compiled by the included egcs-2.91.57 and run as "sqbproc < sqbinput" aborts for most but not all instances of sqbinput, outputting STATUS_ACCESS_VIOLATION on stderr and in sqbproc.exe.core (a stack trace). Due to its unresolved redirection problem (see mailing list archives .../1999-04/msg00355.html) gdb could not be used for investigation. Analyzing the generated stack traces ("core dumps") by the aid of the linker map shows different origines of the aborts (see below), whereas in all cases pc's in the uppermost four stack frames don't differ and look similar to those reported in .../1999-06/msg00637.html. Sorry I could not localize addresses above 0x61000000 and 0x77F00000. Compilation is done with options -g -O0 -Wall; no warnings are seen besides 4 "defined but not used" (from lex and yacc). Options -O1 to O2 as suggested anywhere have no effect. Linking for increased heap size (-Wl,heap,... , to 10 times the default of 0x00100000) is reflected in the map's or objdump's "size_of_heap_reserve" but does not affect aborting. The binary's size is appox. 490 Kb. The behavior found is hard to understand. For many years the program works fine under SunOS 4.1 to 5.6 (gcc up to 2.7.2.3 as well as other compilers) and recently under NT when compiled by MSC. Using [f]lex and [a]yacc (up to now under SunOS), this C program implements a special description language and processes a data set, written in that language and taken from stdin, into a set of tables output as C files consisting of arrays. For doing so it opens about 40 files for writing and reading (or vice versa, all in binary mode) during an init phase and then calls malloc very often. Four data sets were tested. Due to the principle they have the same structure though differing in size (approx. 4/47/88/22 Kb). They cause the program to work differently. The smallest one passes, the second induces an abort by occasion of the first fopen call, but the largest one passes all these fopens producing the exception from inside an user function much later on, probably when calling malloc. The fourth aborts similarly, but without malloc being involved, as far as I can see (address > 0x61...). Diagnostic output from running data set 2 is enclosed here: (Note: On my NT machine Cygwin and MKS Toolkit must coexist.) Output from stderr: ------------------- [main] c:\users\alker\bin\sqbproc.exe 1000 (0) handle_exceptions: Exception: STATUS_ACCESS_VIOLATION [main] sqbproc 1000 (0) handle_exceptions: Dumping stack trace to sqbproc.exe.core sqbproc.exe.core (stack trace): ------------------------------- [main] sqbproc 1000 (0) exception: trapped! [main] sqbproc 1000 (0) exception: code 0xC0000005 at 0x6100D89B [main] sqbproc 1000 (0) exception: ax 0x42A910 bx 0x0 cx 0x61061104 dx 0x10 [main] sqbproc 1000 (0) exception: si 0x401044 di 0x0 bp 0x247CD50 sp 0x247CD4C [main] sqbproc 1000 (0) exception: exception is: STATUS_ACCESS_VIOLATION [main] sqbproc 1000 (0) stack: Stack trace: [main] sqbproc 1000 (0) stack: frame 0: sp = 0x247CB60, pc = 0x6100A2C3 [main] sqbproc 1000 (0) stack: frame 1: sp = 0x247CB9C, pc = 0x77FA4846 [main] sqbproc 1000 (0) stack: frame 2: sp = 0x247CBC0, pc = 0x77F99013 [main] sqbproc 1000 (0) stack: frame 3: sp = 0x247CC4C, pc = 0x77F86392 [main] sqbproc 1000 (0) stack: frame 4: sp = 0x247CD50, pc = 0x6100D95D [main] sqbproc 1000 (1) stack: frame 5: sp = 0x247CD6C, pc = 0x610194E0 [main] sqbproc 1000 (0) stack: frame 6: sp = 0x247CD88, pc = 0x61019345 [main] sqbproc 1000 (0) stack: frame 7: sp = 0x247CE10, pc = 0x6103098E [main] sqbproc 1000 (0) stack: frame 8: sp = 0x247CE44, pc = 0x6105D7E2 [main] sqbproc 1000 (0) stack: frame 9: sp = 0x247CE58, pc = 0x610527CF [main] sqbproc 1000 (0) stack: frame 10: sp = 0x247CE88, pc = 0x6105283A [main] sqbproc 1000 (0) stack: frame 11: sp = 0x247CE9C, pc = 0x409143 [main] sqbproc 1000 (0) stack: frame 12: sp = 0x247CEBC, pc = 0x4011A4 [main] sqbproc 1000 (0) stack: frame 13: sp = 0x247CED0, pc = 0x405752 [main] sqbproc 1000 (0) stack: frame 14: sp = 0x247FE14, pc = 0x410DAD [main] sqbproc 1000 (0) stack: frame 15: sp = 0x247FE1C, pc = 0x61004402 [main] sqbproc 1000 (0) stack: End of stack trace (more stack frames may be present) bash-2.02$ cygcheck -s ---------------------- Cygnus Win95/NT Configuration Diagnostics Current System Time: Tue Aug 17 10:43:46 1999 WinNT Ver 4.0 build 1381 Service Pack 4 Path: /c/users/alker/bin /c/mks/mksnt /c/WINNT/system32 /c/WINNT /c/TNGSD/BIN /c/cygnus/CYGWIN~1/H-I586~1/bin . SysDir: C:\WINNT\System32 WinDir: C:\WINNT HOME = `/c/users/alker' PWD = `/c/users/alker/bin' Use `-r' to scan registry a:\ fd N/A N/A c:\ hd NTFS 4353Mb 24% CP CS UN PA FC NTFS g:\ net NTFS 2060Mb 58% CP CS UN PA FC h:\ net SUNWNFS 1090Mb 67% CP magnus k:\ net SUNWNFS 4781Mb 100% donau m:\ net SUNWNFS 4959Mb 96% CP magnus r:\ cd N/A N/A s:\ net SUNWNFS 193Mb 43% CP magnus c:\cygnus\root / native text=binary h:\swarchiv\src\gpib /asg native text=binary c:\cygnus\cygwin-b20\H-i586-cygwin32\bin /bin native text=binary c: /c native text=binary h: /h native text=binary c:\temp /tmp native text=binary Found: c:\cygnus\CYGWIN~1\H-I586~1\bin\bash.exe Found: c:\mks\mksnt\cat.exe Found: c:\cygnus\CYGWIN~1\H-I586~1\bin\cat.exe Found: .\cpp.exe Found: c:\users\alker\bin\cpp.exe Found: c:\mks\mksnt\find.exe Found: c:\cygnus\CYGWIN~1\H-I586~1\bin\find.exe Found: c:\cygnus\CYGWIN~1\H-I586~1\bin\gcc.exe Found: c:\cygnus\CYGWIN~1\H-I586~1\bin\gdb.exe Found: c:\cygnus\CYGWIN~1\H-I586~1\bin\ld.exe Found: c:\mks\mksnt\ls.exe Found: c:\cygnus\CYGWIN~1\H-I586~1\bin\ls.exe Found: c:\mks\mksnt\make.exe Found: c:\cygnus\CYGWIN~1\H-I586~1\bin\make.exe Found: c:\mks\mksnt\sh.exe Found: c:\cygnus\CYGWIN~1\H-I586~1\bin\sh.exe 371k 1998/12/01 c:\cygnus\CYGWIN~1\H-I586~1\bin\cygtcl80.dll 5k 1998/12/01 c:\cygnus\CYGWIN~1\H-I586~1\bin\cygtclpip80.dll 10k 1998/12/01 c:\cygnus\CYGWIN~1\H-I586~1\bin\cygtclreg80.dll 600k 1998/12/01 c:\cygnus\CYGWIN~1\H-I586~1\bin\cygtk80.dll 446k 1998/12/03 c:\cygnus\CYGWIN~1\H-I586~1\bin\cygwin1.dll bash-2.02$ cygcheck -v sqbproc.exe ---------------------------------- Found: .\sqbproc.exe Found: c:\users\alker\bin\sqbproc.exe Warning: .\sqbproc.exe hides c:\users\alker\bin\sqbproc.exe .\sqbproc.exe - os=4.0 img=1.0 sys=4.0 c:\cygnus\CYGWIN~1\H-I586~1\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0 "cygwin1.dll" v0.0 ts=1998/12/4 5:39 C:\WINNT\System32\advapi32.dll - os=4.0 img=4.0 sys=4.0 "ADVAPI32.dll" v0.0 ts=1998/9/29 22:44 C:\WINNT\System32\ntdll.dll - os=4.0 img=4.0 sys=4.0 "ntdll.dll" v0.0 ts=1998/10/8 21:30 C:\WINNT\System32\KERNEL32.dll - os=4.0 img=4.0 sys=4.0 "KERNEL32.dll" v0.0 ts=1998/10/13 10:38 C:\WINNT\System32\ntdll.dll (already done) C:\WINNT\System32\USER32.dll - os=4.0 img=4.0 sys=4.0 "USER32.dll" v0.0 ts=1998/10/13 10:39 C:\WINNT\System32\ntdll.dll (already done) C:\WINNT\System32\KERNEL32.dll (already done) C:\WINNT\System32\GDI32.dll - os=4.0 img=4.0 sys=4.0 "GDI32.dll" v0.0 ts=1998/9/23 8:27 C:\WINNT\System32\ntdll.dll (already done) C:\WINNT\System32\KERNEL32.dll (already done) C:\WINNT\System32\USER32.dll (recursive) C:\WINNT\System32\ADVAPI32.dll (recursive) C:\WINNT\System32\ADVAPI32.dll (recursive) C:\WINNT\System32\RPCRT4.dll - os=4.0 img=4.0 sys=4.0 "RPCRT4.dll" v0.0 ts=1998/10/9 21:19 C:\WINNT\System32\ntdll.dll (already done) C:\WINNT\System32\KERNEL32.dll (already done) C:\WINNT\System32\ADVAPI32.dll (recursive) C:\WINNT\System32\kernel32.dll (already done) C:\WINNT\System32\user32.dll (already done) C:\WINNT\System32\kernel32.dll (already done) (End of diagnostic output) Any hint would be highly appreciated. Regards, Dietrich Alker E-mail: dietrich-e DOT alker AT wwgsolutions DOT com or alker AT wago DOT de c/o Wavetek Wandel Goltermann, Dept. 1ET POB 1262, 72795 Eningen, Germany -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com