Compare the -S output with and without -O2. If you've found a compiler bug, I'd bet that it's the loop unroller incrementing counter before the == 0 test has dereferrenced it--thus the test is always false. Oh, and btw, 60% is not 2/3rds. It's 3/5ths. Just pointing out that the code doesn't match your description. ;)