miscompiled loop condition

Stephen L Moshier moshier@mediaone.net
Tue Nov 30 23:39:00 GMT 1999


Further information.
Snapshots up through November 22 do not have the cited bug.
Commenting out "try_copy_prop" from this installed change
makes the bug go away:

1999-11-23  Bernd Schmidt  <bernds@cygnus.co.uk>

	* loop.c: Include "basic-block.h".
	(try_copy_prop, replace_loop_reg): New functions.
	(load_mems): Detect registers that just hold copies of the hoisted
	mem, and call try_copy_prop to eliminate them.

Original bug follows.
-----------
November 25 CVS

In this test case the expression in the while condition gets
miscompiled with -O2 on i386 and sparc.  The result is that the
program loops endlessly when it is run.


double x, y;

int
main()
{
  x = 2.0;
  y = x;
  do
    {
      x = y;
      y = 2.0 * y;
    }
  while ( ! ((y -x) >= 20));
}
------------



More information about the Gcc-bugs mailing list