Applied fix mentioned in bugreport 3370. Seems to solve the issue.
fixed comparison to stop integer wrap around
fixed compilation with CUDA 6.0:

GpuMat::setTo function, removed NPP call for CV_8S
fixing build of 2.4 branch with VC12 (aka 2013)
(master branch was fixed before, no need to merge this to master!)
- disable openexr (numerous undefined std::min & std::max)
- workaround for two compilator bugs
fix gpu test for Demosaicing:

check that input images was loaded correctly
added additional check in cv::gpu::demosaicing that source is not empty
ocl:perf: fix moments test for plain impl
Added patch from master for fixing VS2013 in 3rd party lib OpenEXR
Fixed the "platfrom" typo everywhere.
fixing compilation on Linux
Merge pull request #1916 from alalek:ocl_moments_fix_perf
Merge pull request #1911 from apavlenko:2.4_fix_vc12
Fixed a -Wundef warning in cl_platform.h.

_MSC_VER -> defined _MSC_VER. Fixes building with MinGW.
Similar to fbc91c5ee.
ocl: try to disable clFinish workaround
Merge pull request #1915 from jet47:gpu-color-test-fix
Merge pull request #1919 from SpecLad:platfrom
Merge pull request #1921 from SpecLad:defined-msc-ver
Add OpenCL SVM paths for bagofwords_classification and points_classifier samples.
Add Macro to decide using ocl method or not.
Modify default setting, using ocl method when have ocl module