Bug in GCC 2.95.2
Mumit Khan
khan@NanoTech.Wisc.EDU
Fri Dec 31 20:54:00 GMT 1999
On Mon, 13 Dec 1999, Robert Ruehlmann wrote:
> I think I've found a bug in gcc 2.95.2 for Intel x86 (tested with DJGPP).
>
> When optimized with -O2 the following small sample program goes into an
> infinite loop. Debugging with gdb shows strange behaviour like
> modifications of the 'size' variable.
>
> <-- cut here -->
> static void bug(int size, int tries)
> {
> int i;
> int num = 0;
>
> while (num < size)
> {
> for (i = 1; i < tries; i++) num++;
> }
> }
>
> int main()
> {
> bug(5, 10);
> return 0;
> }
> <-- cut here -->
Strength reduction bug perhaps?. See if -O2 -fno-strength-reduce works
(I have something similar in my code that was causing this problem as
well, and I had to resort to -fno-strength-reduce). Happens on both
gcc-2.95.2 and CVS/mainline.
Regards,
Mumit
More information about the Gcc-bugs
mailing list