RE: Possible VC7.1 C++ Optimizer Error with intrinsic _byteswap_uint64 when compiler enters register contention (0/1)
- From: v-garych@xxxxxxxxxxxxxxxxxxxx ("Gary Chang[MSFT]")
- Date: Wed, 06 Jul 2005 10:07:27 GMT
Hi Ivan,
I have already downloaded your sample project to our local machine, and
perform some tests(using "b=_strtoui64(av[2],&ptr,0");). The problem is the
oupput of the release version app(optimized) will always be invalid--zero,
meanwhile the debug version app works well. Please let me know if my test
results is different from yours.
>Unfortunatelly, it seems that when a certain number of complex
>operations are performed before the _byteswap_uint64() function is
>evaluated (leading to a possible contention in register usage), the
>intrinsic generation of the _byteswap_uint64 gets confused as to what
>register is actually holding the results.
I agree with you that the problem is caused by the incorrect optimization
to the program: in the release version the _byteswap_uint64 operation code
will be inlined to the caller program's code, and just as your sample
assembly code illustrated, the inline code has the error.
Based on my repeated test, I found the root cause of the misoptimization
appears to be av[1]/av[2], which the program arguments you used directly in
the _strtoui64 function call. If use a const integer or a character buffer
instead, then the release version program would work as well as the debug
version one, such as:
char bufA[8], bufB[8];
memcpy(bufA, av[1], 8);
memcpy(bufB, av[2], 8);
a=_strtoui64(bufA,&ptr,0);
b=_strtoui64(bufB,&ptr,0);
//res1 = a & b;
res = _byteswap_uint64(a & b);
...
Thanks!
Best regards,
Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- References:
- Prev by Date: Re: Call Windows API MessageBox from a MessageBox class....
- Next by Date: Re: Display chinese characters?
- Previous by thread: Re: Possible VC7.1 C++ Optimizer Error with intrinsic _byteswap_uint64 when compiler enters register contention (0/1)
- Next by thread: trapping SIGABRT from a DLL
- Index(es):
Relevant Pages
|