Visual C++ 2003 optimization bug

  • Thread starter Thread starter Andrew Burlak
  • Start date Start date
A

Andrew Burlak

This piece of code prints "Hello, World!" only once if optimizations are
enabled.
It is expected to print "Hello, World!" 2^32 times.

Optimizations: /O2
Compiler version: 13.10.3077 (VS.Net 2003)

= = = = = = = = =

#include <stdio.h>

void main(void)
{
unsigned i = 0;
do
{
printf ("Hello, World!\n");
++i;
}
while (i != 0);
}

= = = = = = = = =
Best regards,
Andrew Burlak.
 
This piece of code prints "Hello, World!" only once if optimizations are
enabled.
It is expected to print "Hello, World!" 2^32 times.

Andrew,

I can repro this incorrect optimization with VS2003, but it appears to
be resolved with the current Whidbey alpha compiler.

Merry Christmas
Dave
 
Back
Top