[flac-dev] [PATCH] workaround for a bug in MSVC 2015 U2

lvqcl lvqcl.mail at gmail.com
Mon May 2 10:22:12 UTC 2016


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.


More information about the flac-dev mailing list