Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2007

Tip: Looking for answers? Try searching our database.

VC 64-bit compiler BUG

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Igor Pavlov - 01 Feb 2007 11:56 GMT
Probably there is bug in VC 64-bit compiler (in all versions)

Compile and run the following code with speed optimization (-O2):

#include <stdio.h>

typedef int (*fp)(const unsigned char *buf, unsigned int pos, unsigned int
num);

int f(const unsigned char *buf, unsigned int pos, unsigned int num)
{
 int sum = 0;
 for (; num != 0; num--)
   sum += buf[(size_t)pos++];  
 return sum;
}

fp t = f;

int main()
{
 unsigned char buffer[1] = { 0 };
 unsigned int pos = 0x80000000;
 return t(buffer - pos, pos, 1);
}

Bug description:
pos is unsigned int, but VC compiler uses  
movsxd    r9, edx
command to extend from unsigned int to size_t
Carl Daniel [VC++ MVP] - 01 Feb 2007 15:17 GMT
> Probably there is bug in VC 64-bit compiler (in all versions)
>
[quoted text clipped - 26 lines]
> movsxd r9, edx
> command to extend from unsigned int to size_t

That does sound like a bug, although it's impossible to tell from a single
assembly instruction without having a 64-bit compiler to try it out on.

Please post a bug report at

http://connect.microsoft.com/feedback?SiteID=210

-cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.