x64 optimization bug in Visual Studio 2010
-
23 iulie 2012 22:10
Hi,
The following code produces incorrect output in Release x64 configuration:
#include <iostream> #include <vector> int wmain(int argc, wchar_t* argv[]) { std::vector<size_t> s; /* 1 */ size_t volatile three = 3; size_t volatile four = 4; size_t a = three; size_t b = four; if (a != b) { size_t n = std::min(a, b); /* 2 */ size_t x = std::max(a, b); std::cout << n << std::endl; std::cout << x << std::endl; } return 0; }
Actual output: 4 4
Expected output: 3 4
If I remove line /* 1 */ or change /* 2 */ to a < b ? a : b; it works as expected.
Release Win32 works as expected.
Debug x64 works as expected.
Toate mesajele
-
24 iulie 2012 05:39
Confirmed. The bug is in Visual Studio 2010 but has been fixed in Visual Studio 2012 RC.
Obviously, Microsoft must be aware of this but I suggest submitting a report anyway to http://connect.microsoft.com.
- Propus ca răspuns de Jacky Wu - MSFT 23 august 2012 08:14
-
24 iulie 2012 11:33http://connect.microsoft.com allows only to submit bug reports for Visual Studio 2012 RC, not for 2010 or any other versions of Visual Studio.
-
24 iulie 2012 15:58I suggest using VS 2012 RC to address your problem. I don't hesitate to recommend VS 2012 RC for production use.
-
24 iulie 2012 16:04
-
25 iulie 2012 03:13
-
27 iulie 2012 06:42Moderator
Hi Igor Afanasyev,
If you are submitting feedback on Visual Studio 2010 and .NET Framework, please use the MS forums or contact MS support directly at http://support.microsoft.com or call 1-800-MICROSOFT.
See more details here: https://connect.microsoft.com/VisualStudio/content/content.aspx?ContentID=27774
Meanwhile, thanks for sharing your experience. It's a good reference for anyone else encounters same issue.
Best Regards,
Damon
Damon Zheng [MSFT]
MSDN Community Support | Feedback to us