PATCH: incorrect optimization of ((i < 0) && (i >= 0))

Jeffrey A Law law@hurl.cygnus.com
Sun Feb 28 18:15:00 GMT 1999


  > Hi,
  > attached is a patch and test case for the above problem.
  > 
  > range_binop is used inside merge_ranges to compare two range ends, each of
  > which might be unbounded. (have an infinite end value) Where at least one o
  > f
  > the ends is unbounded, a reduction is made using the algebraic rules of
  > unbounded values and a yes/no result is returned.
  > 
  > This is incorrect on two counts.
  > 1) If both values are unbounded, we sometimes have to give a `maybe' result
  > ,
  > rather than a definite yes/no answer.
  > 2) but we're not in the domain of infinite integers, we're in the domain of
  > fixed length comupter arithmetic. It is therefore legitimate to replace any
  > unbounded range (infinite value), with the specific value Z, larger than an
  > y
  > representable value. Doing the comparisons against Z leads to consistent
  > results where we can always give a yes/no result.
  > 
  > This patch does that. When one of the values is unbounded, we replace the
  > comparision with that of -Z, not Z, +Z.
  > 
  > Running the existing test suite with this patch gives no changes in the pas
  > ses
  > and failures on a sparc solars 2.6 box.
  > 
  > The provided test case, causes the current snapshot to abort at -O1 and
  > greater, without this patch.
  > 
  > nathan
  > 
  > -- 
  > Dr Nathan Sidwell :: Computer Science Department :: Bristol University
  >       You can up the bandwidth, but you can't up the speed of light      
  > nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk
  > --------------B38FF8D3F338CB70A5AC71BB
  > Content-Type: text/plain; charset=us-ascii; name="interval.patch"
  > Content-Transfer-Encoding: 7bit
  > Content-Disposition: inline; filename="interval.patch"
  > 
  > Thu Feb  4 15:02:22 GMT 1999  Nathan Sidwell  <nathan@acm.org>
  > 
  > 	* fold-const.c (range_binop): Take account of the bounded nature
  > 	of fixed length arithmetic when comparing unbounded ranges.
I installed the patch and the new testcase.

Thanks!
jeff

ps. I installed the fix on the egcs-1.1.2 branch too.



More information about the Gcc-patches mailing list