Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 21533, Guram Dukashvili

by Guram Dukashvili Email: Anonymous


Bug in codegenerator for 64 bit shifting
C++Builder 6.0 UpdatePack 4
Download Details
FTP  download also available 0 bytes
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For C++Builder, Version 6.0  to 6.0 4 downloads
Copyright: No significant restrictions


Size: 0 bytes
Updated on Thu, 11 Mar 2004 02:57:15 GMT
Originally uploaded on Thu, 11 Mar 2004 02:58:04 GMT
Description
#pragma option -Od
/*
if compile with optimization then bug is dissapear
*/

#include

struct TCoreHeader {
uint64_t ClusterSize;
};

class Bugger : public TCoreHeader {
public:
Bugger & __fastcall Method(void * dummy2,bool dummy3);
};

Bugger & __fastcall Bugger::Method(void * dummy2,bool dummy3)
{
uint32_t dummy1;

Bugger * h = new Bugger;

/*
if remove next line 'for(' then bug is dissapear
*/
for( dummy1 = 0; dummy1 < 100; dummy1++ );

h->ClusterSize = 0x100000;
/* Bug here */
for( ClusterSize = 1; ClusterSize < h->ClusterSize; ClusterSize <<= 1 );

/* solution */
#if __BCPLUSPLUS__
unsigned __int64 ClusterSizeLoc;
for( ClusterSizeLoc = 1; ClusterSizeLoc < h->ClusterSize; ClusterSizeLoc <<= 1 );
h->ClusterSize = ClusterSizeLoc;
#else
for( ClusterSize = 1; ClusterSize < h->ClusterSize; ClusterSize <<= 1 );
h->ClusterSize = ClusterSize;
#endif
return *this;
}

int main(int,char**)
{
Bugger * b = new Bugger;
b->Method(0,false);
return 0;
}

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Server Response from: ETNACDC03