Re: [flac-dev] crash on lpc_restore_signal_16_intrin_sse2
On 9.3.2015 19:06, lvqcl wrote: Tristan Matthews wrote: Hi, VLC recently migrated to libflac 1.3.1, however we had to revert to 1.3.0 as we had crashes for most FLAC files on the Windows desktop platform. More information is available here: https://trac.videolan.org/vlc/ticket/14104 Cannot reproduce the crash here. Also I downloaded VLC 2.2.0 (32-bit Windows build) and it also doesn't crash. VLC 2.2.0 crashed with exception 0xc005 on the first file I tried. But libflac itself does not, for example flac.exe and foobar2000 have no issues. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] crash on lpc_restore_signal_16_intrin_sse2
Tristan Matthews le.business...@gmail.com wrote: Cannot reproduce the crash here. Also I downloaded VLC 2.2.0 (32-bit Windows build) and it also doesn't crash. You tested with files encoded with -7 or -8? Yes. FLAC 1.2.1, 1.3.1, -7 and -8 options. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] crash on lpc_restore_signal_16_intrin_sse2
On Mon, Mar 9, 2015 at 5:15 PM, lvqcl lvqcl.m...@gmail.com wrote: Janne Hyvärinen wrote: I compiled flac.exe without NASM and verified that FLAC__lpc_restore_signal_16_intrin_sse2 is used. Decoding the same file that made VLC 2.2 crash decoded without issues. Would be nice if VLC was compilable with MSVC and we could use its debugger. VLC 2.2.0 crashes here inside WinXP VM on instruction: movaps xmmword ptr [esp+10h], xmm7 And ESP is equal to 0x02A8FCC8. The stack is not properly aligned for some reason, yet GCC uses movaps instruction. Sounds a bit like: http://www.peterstock.co.uk/games/mingw_sse/ Also worth noting, VLC uses yasm but not nasm, so we may be able to sidestep this problem by adding nasm to our toolchain. That said, it still seems like other people using MinGW and libFLAC will get bit by this so I'll keep digging. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] crash on lpc_restore_signal_16_intrin_sse2
Tristan Matthews wrote: Sounds a bit like: http://www.peterstock.co.uk/games/mingw_sse/ Also worth noting, VLC uses yasm but not nasm, so we may be able to sidestep this problem by adding nasm to our toolchain. Then you're probably not guaranteed from crashes inside FLAC__lpc_restore_signal_wide_intrin_sse41() function. Looks like it also requires aligned stack when compiled with GCC. (libFLAC uses it to decode 24-bit flac files) That said, it still seems like other people using MinGW and libFLAC will get bit by this so I'll keep digging. Great. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] crash on lpc_restore_signal_16_intrin_sse2
Janne Hyvärinen wrote: VLC 2.2.0 crashed with exception 0xc005 on the first file I tried. But libflac itself does not, for example flac.exe and foobar2000 have no issues. *Very* interesting. I suspect that flac.exe and foobar2000 don't use FLAC__lpc_restore_signal_16_intrin_sse2() function at all. This function is not used if NASM is available; FLAC__lpc_restore_signal_asm_ia32_mmx() is used instead. I wonder how to debug this crash... ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] crash on lpc_restore_signal_16_intrin_sse2
On 9.3.2015 20:43, lvqcl wrote: Janne Hyvärinen wrote: VLC 2.2.0 crashed with exception 0xc005 on the first file I tried. But libflac itself does not, for example flac.exe and foobar2000 have no issues. *Very* interesting. I suspect that flac.exe and foobar2000 don't use FLAC__lpc_restore_signal_16_intrin_sse2() function at all. This function is not used if NASM is available; FLAC__lpc_restore_signal_asm_ia32_mmx() is used instead. I wonder how to debug this crash... I compiled flac.exe without NASM and verified that FLAC__lpc_restore_signal_16_intrin_sse2 is used. Decoding the same file that made VLC 2.2 crash decoded without issues. Would be nice if VLC was compilable with MSVC and we could use its debugger. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
[flac-dev] [PATCH 1/1] ensure that stack is aligned for SSE functions if using mingw32
Unable to test on win32 at the moment, please give this a try. Feedback welcome. Avoids crashes due to unaligned ops when built with mingw. --- src/libFLAC/include/private/cpu.h | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libFLAC/include/private/cpu.h b/src/libFLAC/include/private/cpu.h index 8927897..bd40012 100644 --- a/src/libFLAC/include/private/cpu.h +++ b/src/libFLAC/include/private/cpu.h @@ -72,8 +72,13 @@ #define FLAC__FMA_SUPPORTED 1 #endif #elif defined __GNUC__ + #ifdef __MINGW32__ +#define FLAC__STACK_ALIGN __attribute__((force_align_arg_pointer)) + #else +#define FLAC__STACK_ALIGN + #endif /* SSE stack alignment fixups */ #if (__GNUC__ 4 || (__GNUC__ == 4 __GNUC_MINOR__ = 9)) /* since GCC 4.9 -msse.. compiler options aren't necessary */ -#define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x))) +#define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x))) FLAC__STACK_ALIGN #define FLAC__SSE_SUPPORTED 1 #define FLAC__SSE2_SUPPORTED 1 #define FLAC__SSSE3_SUPPORTED 1 @@ -82,7 +87,7 @@ #define FLAC__AVX2_SUPPORTED 1 #define FLAC__FMA_SUPPORTED 1 #else /* for GCC older than 4.9 */ -#define FLAC__SSE_TARGET(x) +#define FLAC__SSE_TARGET(x) FLAC__STACK_ALIGN #ifdef __SSE__ #define FLAC__SSE_SUPPORTED 1 #endif -- 2.1.0 ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] ensure that stack is aligned for SSE functions if using mingw32
Tristan Matthews wrote: Unable to test on win32 at the moment, please give this a try. Feedback welcome. I wonder why misaligned stack is a problem only for the FLAC library. There are many other libraries inside VLC... BTW: FLAC 1.3.1 uses -msse2 option by default. Do you remove it? Otherwise libFLAC may crash anywhere else (if its stack is not aligned). ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] ensure that stack is aligned for SSE functions if using mingw32
On 03/09/15 03:59 PM, lvqcl wrote: Tristan Matthews wrote: Unable to test on win32 at the moment, please give this a try. Feedback welcome. I wonder why misaligned stack is a problem only for the FLAC library. There are many other libraries inside VLC... BTW: FLAC 1.3.1 uses -msse2 option by default. Do you remove it? Otherwise libFLAC may crash anywhere else (if its stack is not aligned). One workaround is to use -mstackrealign where ever -msse2 is used Dave ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] ensure that stack is aligned for SSE functions if using mingw32
On Mon, Mar 9, 2015 at 7:57 PM, Dave Yeo dave.r@gmail.com wrote: On 03/09/15 03:59 PM, lvqcl wrote: Tristan Matthews wrote: Unable to test on win32 at the moment, please give this a try. Feedback welcome. I wonder why misaligned stack is a problem only for the FLAC library. There are many other libraries inside VLC... BTW: FLAC 1.3.1 uses -msse2 option by default. Do you remove it? Otherwise libFLAC may crash anywhere else (if its stack is not aligned). One workaround is to use -mstackrealign where ever -msse2 is used Yes, that was one of the options mentioned in the article I linked (http://www.peterstock.co.uk/games/mingw_sse) ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev