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

lvqcl lvqcl.mail at gmail.com
Mon May 2 15:07:43 UTC 2016


Erik de Castro Lopo wrote:

> Ok, I'll take the original patch as it is. DO you have a link to a
> bug report on this problem? It would be nice to put it in a comment
> above the workaround.

:sigh: I hoped that somebody else will find what's wrong and will create a bugreport...

Well, here is the link:   https://connect.microsoft.com/VisualStudio/feedback/details/2659191/incorrect-code-generation-for-x86-64


It seems that MSVC miscompiles
     abs_residual_partition_sums[partition] = (FLAC__uint32)_mm_cvtsi128_si32(mm_sum);
into
     movq    QWORD PTR [rsi], xmm2

So it incorrectly copies 8 bytes from mm_sum to abs_residual_partition_sums[partition]
(it should copy 4 lower bytes and zero out 4 upper bytes).

It should be something like
     movd    eax, xmm2
     movq    QWORD PTR [rsi], rax


More information about the flac-dev mailing list