Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004245OCamlOCaml generalpublic2007-03-29 16:122011-05-29 12:14
Reportermottl 
Assigned Toxleroy 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.09.3 
Target VersionFixed in Version3.12.0+dev 
Summary0004245: Integer conversions do not detect overflow in corner cases
DescriptionThis should not be accepted:

  # Int32.of_string "2147483648";;
  - : int32 = -2147483648l

This is correctly rejected (first number + 1):

  # Int32.of_string "2147483649";;
  Exception: Failure "int_of_string".

And this is correctly accepted (first number - 1):

  # Int32.of_string "2147483647";;
  - : int32 = 2147483647l

The corner case is obviously not handled correctly.

The same problem happens with the other integer conversions: Int64.of_string, Nativeint.of_string, and even int_of_string.
TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0004210closedxleroy little bug in int_of_string 
related to 0003302closed Int64.of_string does not detect overflow from positive to negative ints 

-  Notes
(0003995)
oandrieu (reporter)
2007-03-29 16:37

> The corner case is obviously not handled correctly.

actually, that's on purpose, cf. Xavier's comments in bug 0004210
(0005025)
xleroy (administrator)
2009-07-15 16:56

See comments on PR#4210

- Issue History
Date Modified Username Field Change
2007-03-29 16:12 mottl New Issue
2007-03-29 16:37 oandrieu Note Added: 0003995
2007-04-03 18:00 doligez Relationship added duplicate of 0004210
2007-04-03 18:01 doligez Severity major => minor
2007-04-03 18:01 doligez Status new => closed
2007-04-03 18:01 doligez Resolution open => won't fix
2009-07-15 16:56 xleroy Note Added: 0005025
2009-07-15 16:56 xleroy Status closed => resolved
2009-07-15 16:56 xleroy Resolution won't fix => fixed
2009-07-15 16:56 xleroy Fixed in Version => 3.12.0+dev
2009-07-15 16:58 xleroy Assigned To => xleroy
2009-08-28 11:28 xleroy Relationship added related to 0003302
2011-05-29 12:14 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker