Sun 4.1 cc's -O is broken on Sun 3's for levels greater than 1
Arthur David Olson
elsie!ado at ncifcrf.gov
Sun May 27 08:53:54 AEST 1990
Here's an excerpt from a bug report that's gone off to Sun.
Description:
The SunOS 4.1 C compiler's optimizer is broken on Sun 3's for optimization
levels above 1.
Repeat-By:
Note the different output below when compiling with different flags.
Script started on Sat May 26 18:48:20 1990
elsie$ uname -a
SunOS elsie 4.1 1 sun3
elsie$ cat try.c
#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);
}
elsie$ cc try.c
elsie$ a.out
50
48
49
elsie$ cc -g try.c
elsie$ a.out
50
48
49
elsie$ cc -O1 try.c
elsie$ a.out
50
48
49
elsie$ cc -O2 try.c
elsie$ a.out
50
48
elsie$ cc -O try.c
elsie$ a.out
50
48
elsie$ exit
script done on Sat May 26 18:49:05 1990
Workaround:
Don't use optimization levels greater than one.
Arthur David Olson ado at alw.nih.gov ADO is a trademark of Ampex.
More information about the Comp.sys.sun
mailing list