Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 28 Apr 2004 15:08:46 -0400 From: Christopher Faylor To: tbp , cygwin AT cygwin DOT com Subject: Re: g++ 3.4.0 cygwin, codegen SSE & alignement issues Message-ID: <20040428190846.GA9889@coe.bosbc.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: tbp , cygwin AT cygwin DOT com References: <408F2C65 DOT 4090804 AT ompf DOT org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i On Wed, Apr 28, 2004 at 12:41:51PM -0500, Brian Ford wrote: >On Wed, 28 Apr 2004, tbp wrote: > >> Building an app of mine (multithreaded) with something like -O3 >> -march=k8 the binary died with an illegal instruction. The offending >> instruction was a 'movaps %xmm0, 0x40(%esp)' with an unaligned esp. >> As that was on a secondary thread after some external calls (opengl and >> so on) i thought it had to do with some cygwin/ABI issue or something. >> >> After a day of struggling/web digging, i still had no clue. >[snip] >> I'm puzzled & surprised that nobody tripped that one earlier and i'd >> apreciate any clue. > >http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14776 > >I'm working with Red Hat to resolve this issue right now. The problem is >that thread stacks are not always 16 byte aligned. You could try the >following hack if you need something right away and don't mind building >your own Cygwin DLL. This patch would only affect non-main threads. It would not affect the main thread. Wouldn't you need to do the same thing for the main thread? I don't understand why it would be different. cgf >2004-04-28 DJ Delorie > > * init.cc (threadfunc_fe): Hack to make thread stacks always 16 > byte aligned. > >Index: init.cc >=================================================================== >RCS file: /cvs/src/src/winsup/cygwin/init.cc,v >retrieving revision 1.32 >diff -u -p -r1.32 init.cc >--- init.cc 22 Mar 2004 18:30:38 -0000 1.32 >+++ init.cc 28 Apr 2004 17:38:03 -0000 >@@ -27,6 +27,8 @@ HANDLE sync_startup; > static void WINAPI > threadfunc_fe (VOID *arg) > { >+ (void)__builtin_return_address(1); >+ asm volatile ("andl $-16,%%esp" ::: "%esp"); > _cygtls::call ((DWORD (*) (void *, void *)) (((char **) >_tlsbase)[OLDFUNC_OFFSET]), arg); > } > >-- >Brian Ford >Senior Realtime Software Engineer >VITAL - Visual Simulation Systems >FlightSafety International >the best safety device in any aircraft is a well-trained pilot... > >-- >Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple >Problem reports: http://cygwin.com/problems.html >Documentation: http://cygwin.com/docs.html >FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/