[comp.unix.wizards] Optimizer Bug in SysV 3.1 C Compiler

earl@wcc.oz (Earl Chew) (02/10/88)

Hello World,

There appears to be a bug in the optimizer of the System V/VME 3.1 C Compiler
(Rel 2.0). Compile the following with:

		cc -o foo foo.c

and it will print 1.0000. Compile with

		cc -O -o foo foo.c

and I get a bus error (core dumped). Can anyone help?

					Regards,
						Earl Chew
						Webster Computer R & D
--------Cut Here-------
main()

{
  double v;
  void setvar();

  setvar(&v, 1.0);
  (void) printf("%f\n", v);
  return 0;
}

void
setvar(v, n)

double *v, n;

{
  *v = n;
}
--------Cut Here---------