Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003302OCamlOCaml generalpublic2004-11-25 13:262011-05-29 12:20
Reporteradministrator 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version3.12.0+dev 
Summary0003302: Int64.of_string does not detect overflow from positive to negative ints
DescriptionMessieurs,

I would have expected Int64.of_string to detect overflow when an
apparently positive string produces a negative integer:

: nr@toller 11359 ; ocaml
        Objective Caml version 3.08.1

# Int64.of_string "9223372036854775808";;
- : int64 = -9223372036854775808L
#



Norman

TagsNo tags attached.
Attached Files

- Relationships
related to 0004210closedxleroy little bug in int_of_string 
related to 0004245closedxleroy Integer conversions do not detect overflow in corner cases 
related to 0003582acknowledged (1073741824 = -1073741824) is true ! 

-  Notes
(0000240)
administrator (administrator)
2005-02-02 17:58

Proposed behavior for int_of_string would be good. However, integer literals in
source code are read as '-' followed by a positive integer converted with
int_of_string. Hence the latter must not fail on 2^(N-1), otherwise - 2^(N-1)
cannot be represented. One possibility would be to use conversions other than
int_of_string et al in the lexer.
(0005065)
xleroy (administrator)
2009-08-28 11:29

Fixed in CVS trunk, will be in 3.12.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2008-01-22 17:04 doligez Relationship added related to 0003582
2009-08-28 11:28 xleroy Relationship added related to 0004210
2009-08-28 11:28 xleroy Relationship added related to 0004245
2009-08-28 11:29 xleroy Note Added: 0005065
2009-08-28 11:29 xleroy Status acknowledged => resolved
2009-08-28 11:29 xleroy Resolution open => fixed
2009-08-28 11:29 xleroy Fixed in Version => 3.12.0+dev
2009-08-28 11:29 xleroy Description Updated
2011-05-29 12:20 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker