G
Guest
We are using Visual Studio .NET 2003. When using that compiler, the
following example code goes into an endless loop in the "while" loop when the
/Og optimization option is used:
#include <stdlib.h>
int resize(int *incsize, int min_size) {
while(*incsize <= min_size) {
*incsize = (int)(*incsize * 1.25);
}
if ( min_size > 60 ) return 0;
else return min_size;
}
int main() {
int incsize = 10;
return resize(&incsize, 12);
}
The problem occurs when using a pointer and real value for the
multiplication in the while loop. It also requires some additional code
(other than just a return or print statement) after the loop.
To me, this looks like a compiler bug. I looked on Microsoft web site for
patches to Visual Studio .NET 2003 but I did not see any. Does anyone know
of a patch for this issue and if so, from where can I down load it?
Thanks,
following example code goes into an endless loop in the "while" loop when the
/Og optimization option is used:
#include <stdlib.h>
int resize(int *incsize, int min_size) {
while(*incsize <= min_size) {
*incsize = (int)(*incsize * 1.25);
}
if ( min_size > 60 ) return 0;
else return min_size;
}
int main() {
int incsize = 10;
return resize(&incsize, 12);
}
The problem occurs when using a pointer and real value for the
multiplication in the while loop. It also requires some additional code
(other than just a return or print statement) after the loop.
To me, this looks like a compiler bug. I looked on Microsoft web site for
patches to Visual Studio .NET 2003 but I did not see any. Does anyone know
of a patch for this issue and if so, from where can I down load it?
Thanks,