Disable optimizations in wxQuantize() for MSVC to avoid crash

Compiler seems to generate incorrect code for the dithering code taken from
libjpeg, where it is known to create problems too, so use the same workaround
as libjpeg uses and disable optimizations for this function.

This is unsatisfactory and it would be great to find a way to tweak the code
to avoid the problem, but it's still better than crashing.

See #17764.
This commit is contained in:
Eric Jensen
2016-05-07 01:49:22 +02:00
committed by Vadim Zeitlin
parent 0698da3d6b
commit caaa08be07

View File

@@ -1026,6 +1026,16 @@ pass2_no_dither (j_decompress_ptr cinfo,
}
}
#ifdef __VISUALC__
/*
for (yet) unknown reasons, the following code produces
bad results or even crashes if the code optimization is
enabled in VC++
disable optimization for now until the reason is discovered
*/
#pragma optimize ("", off)
#endif
void
pass2_fs_dither (j_decompress_ptr cinfo,
@@ -1167,7 +1177,9 @@ pass2_fs_dither (j_decompress_ptr cinfo,
errorptr[2] = (FSERROR) bpreverr2;
}
}
#ifdef __VISUALC__
#pragma optimize ("", on)
#endif
/*
* Initialize the error-limiting transfer function (lookup table).