This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/3384: PowerPC -funroll-loops -fbranch-count-reg misoptimization
- To: m dot hayes at elec dot canterbury dot ac dot nz (Michael Hayes)
- Subject: Re: optimization/3384: PowerPC -funroll-loops -fbranch-count-reg misoptimization
- From: Zoltan Hidvegi <hzoli at austin dot ibm dot com>
- Date: Fri, 27 Jul 2001 19:46:06 -0500 (CDT)
- Cc: hzoli at hzoli dot 2y dot net, dje at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, hzoli at austin dot ibm dot com, m dot hayes at elec dot canterbury dot ac dot nz, mmitchel at gcc dot gnu dot org, bernds at redhat dot com
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