Hello Aleksey, 2016-08-22 13:52 GMT+02:00 Aleksey Vasenev <margtu-f...@ya.ru>: > __attribute__((aligned)) don't work for stack variables in threads created > with _beginthreadex without alignment. > > Signed-off-by: Aleksey Vasenev <margtu-f...@ya.ru> > --- > send it again > github: https://github.com/Ratio2/mingw-w64/tree/align > fix crash: ffmpeg -f lavfi -i testsrc -vcodec libvpx -threads 2 -f null - > problem discuss: https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=2236 > > _beginthreadex does not align the stack on 16-byte boundary as expected > by gcc. > > On x86 targets, the force_align_arg_pointer attribute may be applied to > individual function definitions, generating an alternate prologue and > epilogue that realigns the run-time stack if necessary. This supports > mixing legacy codes that run with a 4-byte aligned stack with modern > codes that keep a 16-byte stack for SSE compatibility. > https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html > > mingw-w64-libraries/winpthreads/src/thread.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mingw-w64-libraries/winpthreads/src/thread.c > b/mingw-w64-libraries/winpthreads/src/thread.c > index 565ea48..c771daf 100644 > --- a/mingw-w64-libraries/winpthreads/src/thread.c > +++ b/mingw-w64-libraries/winpthreads/src/thread.c > @@ -1454,6 +1454,9 @@ pthread_setcanceltype (int type, int *oldtype) > return 0; > } > > +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) > +__attribute__((force_align_arg_pointer)) > +#endif > int > pthread_create_wrapper (void *args) > { > -- > 2.9.1
I guess you have tested your suggested patch? Over all it looks reasonable to me. Regards, Kai ------------------------------------------------------------------------------ _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public