Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <3A80A080.6D2333D@nc.rr.com> Date: Tue, 06 Feb 2001 20:10:24 -0500 From: Greg Smith X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: gcc linkage woes Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit In a previous life (I beleive this was about 5 days ago ;-) Corrina superbly answered some basic questions I had. We've moved on to a new version of our software (http://www.conmicro.cx/hercules/) and have encountered some weirdness on win32 under cygwin but not under some other operating systems that may or may not begin with the letter `l'. OK, so this is basically hobbyist software and people aren't dying and nobody's losing money. There is [at least] one routine that has a local stack size over 4K. In the previous version, the beginning of the routine looked like: routine entry push %ebp mov %esp,%ebp mov $0x303c,%eax call 0x48af98 <_alloca> push %edi push %esi push %ebx r1 = parm1[3] >> 4; mov 0x8(%ebp),%eax add $0x3,%eax mov (%eax),%dl shr $0x4,%dl Now the beginning of our routine is looking like: routine entry: mov $0x303c,%eax call 0x59b66c <_alloca> push %ebp push %edi push %esi push %ebx mov %eax,0x303c(%esp,1) mov %edx,0x3038(%esp,1) mov %ecx,0x3034(%esp,1) r1 = parm1[3] >> 4; mov 0x303c(%esp,1),%eax add $0x3,%eax mov (%eax),%dl shr $0x4,%dl Well %eax, which has parm1, gets trashed, and we get garbage in our variable `r1'!! We can bypass the problem by making our local stack size less than 4K and malloc() the storage we need. Hints ?? (Yes!! I know!! I'm considering contributing!! perhaps in the pthreads area... is cygwin in RTP ? just curious, 'cause I'm in the area) Thanks, Greg -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple