On Mon, 9 Jan 2012, Corinna Vinschen wrote: > On Dec 27 18:06, Brian Ford wrote: > > On Fri, 23 Dec 2011, Corinna Vinschen wrote: > > > > > Sorry, but what I don't get from your reply is if the andl worked or > > > not. > > > > No; by itself, it does not. Adding a "subl $12, %%esp" following it so > > that the stack is 16 byte aligned after the thread arg is pushed does > > work. There are probably more efficient and/or cleaner ways of doing it > > though. > > > > STC attached, but note that it seems to always pass with gcc-4. Only gcc > > 3.4.4 appears to require the extra alignment. > > Ok, this is even more puzzeling. The thread function called from the > thread_wrapper function is NOT the application thread function, but the > Cygwin internal function thread_init_wrapper. Given that this function > is built with the same gcc 4.x compiler as the rest of Cygwin, how on > earth can this fail at all? Shouldn't the alignment be always correct on > the subsequent call to the application function, given that gcc-4 is > supposed to care?
I'm speculating, but I believe gcc-4 only re-aligns the stack in case an instruction in that function requires more strict alignment than the default ABI to save overhead. -- Brian Ford Staff Realtime Software Engineer VITAL - Visual Simulation Systems FlightSafety International the best safety device in any aircraft is a well-trained crew... -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple