Skip to content

little bug in int_of_string #4210

@vicuna

Description

@vicuna

Original bug ID: 4210
Reporter: @oandrieu
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2011-05-29T10:14:04Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.10+dev
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)
Has duplicate: #4245 #4876
Related to: #3302 #3582
Monitored by: rpjames till "Julien Signoles" yminsky nogin @mmottl

Bug description

int_of_string "max_int + 1" does not raise an exception as it should.

max_int ;;

  • : int = 1073741823

int_of_string "1073741824" ;;

  • : int = -1073741824

in byterun/ints.c we have this comment:
/* Signed representation expected, allow -2^(nbits-1) to 2^(nbits - 1) */
the upper bound should be "2^(nbits - 1) - 1"

File attachments

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions