Clojure

GC Issue 40: Overflow check in Numbers.minus (+ patch)

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Reported by achim.passen, Jan 10, 2009
There are some corner cases where "-"  overflows but does not throw an "integer overflow" 
exception:

user=> (- Integer/MAX_VALUE Integer/MIN_VALUE) 
-1 
user=> (- Long/MAX_VALUE Long/MIN_VALUE) 
-1 

The problem seems to be that negating MIN_VALUE yields MIN_VALUE   
again, so it slips through the overflow check. The patch adds extra checks for MIN_VALUE.

version: SVN r1205

http://groups.google.com/group/clojure/browse_thread/thread/3db6cb2b71008e73

 overflow.diff
693 bytes Download
Comment 1 by richhickey, Jan 14, 2009
patch applied - svn 1212 - thanks!
Status: Fixed

People

  • Assignee:
    Unassigned
    Reporter:
    Anonymous
Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: