As I wrote earlier, MSVC 2015 U2 incorrectly compiles stream_encoder_intrin_*.c files for x86-64 platform. As a result, flac works, but compression ratio is close to 1. This patch disables some compiler optimizations, and compression ratio reverts back to normal values. -------------- next part -------------- A non-text attachment was scrubbed... Name: msvc_bug.patch Type: application/octet-stream Size: 2060 bytes Desc: not available URL: <http://lists.xiph.org/pipermail/flac-dev/attachments/20160502/500b40b2/attachment.obj>
Erik de Castro Lopo
2016-May-02 08:15 UTC
[flac-dev] [PATCH] workaround for a bug in MSVC 2015 U2
lvqcl wrote:> As I wrote earlier, MSVC 2015 U2 incorrectly compiles > stream_encoder_intrin_*.c files for x86-64 platform. > As a result, flac works, but compression ratio is close to 1. > This patch disables some compiler optimizations, and > compression ratio reverts back to normal values.Rather than having the same chunk of code in three different files, wouldn't it be nicer to put it in "share/compat.h" and include it as needed? Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo wrote:>> As I wrote earlier, MSVC 2015 U2 incorrectly compiles >> stream_encoder_intrin_*.c files for x86-64 platform. >> As a result, flac works, but compression ratio is close to 1. >> This patch disables some compiler optimizations, and >> compression ratio reverts back to normal values. > > Rather than having the same chunk of code in three different > files, wouldn't it be nicer to put it in "share/compat.h" and > include it as needed?But it will disable optimization on all other files that directly or indirectly include compat.h (that is, almost all files). IMHO it's too broad. It seems that this problem with MSVC is local and only stream_encoder_intrin_*.c are affected. Or do you mean something like that -- share/compat.h: #if defined FLAC_ENABLE_MSVC2015U2_WORKAROUND1 #if (defined _MSC_VER) && (_MSC_FULL_VER == 190023918) && (defined FLAC__CPU_X86_64) #pragma optimize("g", off) /* workaround for a bug in MSVC 2015 U2 */ #endif #endif src/libFLAC/stream_encoder_intrin_*.c: #define FLAC_ENABLE_MSVC2015U2_WORKAROUND1 #include "share/compat.h" -- ? ...Not sure that share/compat.h is a right place for this workarounds. This bug is quite local and doesn't manifest itself in other source files, and share/compat.h is quite global and affects many files.