optimization/3384: PowerPC -funroll-loops -fbranch-count-reg misoptimization
Zoltan Hidvegi
hzoli@austin.ibm.com
Fri Jul 27 17:47:00 GMT 2001
Michael Hayes wrote:
> > Also note that there is still a bug here, that is not new:
> >
> > main(){unsigned int i; for (i = ~0-39; i < ~0u-1; i += 4);}
>
> > This is an infinite loop, but it quits when compiled with -O2. It would
> > be easy to fix for the constant limit case, actually I have some hack for
> > that, but for the variable final value case that would require extra
> > run-time checks for every loop even if they would never overflow, and the
> > standard behavior is undefined anyways, so it probably does not worth
> > fixing it (that was that way even in 2.95).
>
> Do you know what the standard says about these type of loops? I could
Actually I was wrong, as others pointed out, this looks a perfectly
standard infinite loop, even though someone should be crazy to
intentionally write something like that. I really do not want this to
be fixed if this can slow down normal cases.
I believe that the standard does not define the behavior for signed
overflow, but the unsigned overflow behavior is well-defined.
Zoli
More information about the Gcc-bugs
mailing list