I have a large C++ project under Visual Studio 2010 v10.0.40219.1 SP1Rel which I started seeing a bug with on one of our regression tests. When I checked the bug on a dev machine, I couldn't get it to happen, so I copied the exes from the test machine to the dev machine and the bug appeared. I then deleted the source tree including projects from the test machine, copied them from the dev machine, cleaned and rebuilt them on the test machine, and the bug was still there. So basically, the executables built from the same project and configuration on my dev PC, built with the same compiler version and installed hotfixes, differ from those built on the test PC. The only difference is that the dev PC is running Windows 7 64, and the test PC is running XP. I've also checked all linked LIBs and DLLs are the same on both build platforms.
If the same executables produced different results on different PCs, I'd guess it was a platform specific bug of some kind in my code, but the same executables behave consistently on different PCs, just that those compiled on XP behave differently to those compiled on W7 64.
Any ideas why this should be?
Edit Rebuilt the code in a debug configuration on the test machine, and the bug goes away. Currently copying the source trees and tools onto blank XP and W7 pcs, to see if the issue does follow the build platform, or is specific to one of the PCs currently being used.
Edit2 Copied the source tree onto two new PCs, one XP, one Windows7 and rebuilt. Exe exhibits bug only when built on XP release. Doesn't occur on XP debug build, only optimised release build. Win 7 build runs fine on XP and Win 7, XP build shows bug on XP and Win 7. Going to spend a bit of time trying to better isolate the bug to figure out what exactly is happening, but there certainly seems to be compilation differences based on the build platform.
Edit3 Problem was indeed an uninitialised variable, or more precisely an uninitialized struct in a template, something close to;
template<class TYPE>class MyTemplateClass
{
public:
assign(TYPE &x) { x = t; }
TYPE t;
}
Warning level 4 doesn't seem to pick this up.