Sun3 optimizer bug fixed in "next release"

Marianne Mueller mrm at puffin.eng.sun.com
Thu May 31 07:55:58 AEST 1990


Yup, bug in the 4.1 sun3 cc for the program

#include "stdio.h"

        cgf2(x)
        {
                int     dir, step, steps;

                (void) printf("%d\n", x);
                steps = (x == 50) ? 2 : 0;
                dir = -1;
                for (step = steps; step > 0; --step)
                        cgf2(x + dir * step);
        }

        main()
        {
                cgf2(50);
        }


This bug, alas, seems to be present in C 1.0, but gladly, is fixed in the
"next release", for which alpha is just begun.

total proof:

mrm% /usr/lang/SC1.0/cc -O4 optbug.c
mrm% a.out
50
48
49

As you say, the workaround is to compile at -O1.



More information about the Comp.sys.sun mailing list