[Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3

ppr at melexis dot com gcc-bugzilla@gcc.gnu.org
Thu Sep 18 07:59:00 GMT 2008



------- Comment #4 from ppr at melexis dot com  2008-09-18 07:58 -------
The problem seems to be related with the i pointer reaching 0. If the loop
condition is e.g. "while ( i != 2 )" everything is ok.
The same if the "sum = sum + *(i)" is replaced e.g. with "sum = sum + *(i+1)"


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37569



More information about the Gcc-bugs mailing list