http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48602
--- Comment #40 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-04-21 12:44:54 UTC --- Reply to comment #37 Using volatile does not fix the behavior for the "if" condition. I have tried several volatile permutations on it as well. Using "volatile" rather than the "asm volatile" on the "temp" case does resolve that one and the attached case "Test program for optimization" (ie declaring temp as volatile) So, we are stuck at comment #37 at the moment. This has prompted me to think "Why are we doing this in floating point to begin with?" The Fortran Standard model assumes perfect floating representation. The r and rexp_d could be represented in exact ascii decimal form and these tests done after we generate the DTOA string representation of "m". This would require refactoring our code, but it could be done I think and the tests would then be a byte scan which in most cases would exit after a few loop iterations. I suppose this would be a bit slower. Regardless, it is an idea I toss out for comment.