------- Additional Comments From chris at bubblescope dot net 2004-12-15 12:28 ------- Also (stating the perhaps blindingly obvious), this bug is not being caused by the fact that the loop contains a return statement.
int check(int* a,int *b) { int* returnval=b; for(;a<b;++a) if(*a) returnval=a; return returnval; } Also is not optimised. Out of interest, surely when the loop actually involves pointers, then "looping a pointer around the end of memory" is undefined behaviour, and therefore this doesn't have to be considered in terms of optimising (although this won't help the case in the original bug report). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001