|Anonymous | Login | Signup for a new account||2014-12-18 19:25 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004689||OCaml||OCaml general||public||2009-01-09 16:00||2012-08-02 19:25|
|Target Version||Fixed in Version|
|Summary||0004689: Error not raised with max_int+1 integer literal|
- : int = 1073741823
- : int = -1073741824
Error: Integer literal exceeds the range of representable integers of type int
The integer literal 1073741824 should rise an error, since it's greater than max_int. It currently returns an erroneous value.
|Tags||No tags attached.|
Oops, sorry, bad title.
Should be "Error not raised with max_int+1 integer literal", or something like that.
Note: for technical reasons, this is unlikely to be fixed in the near future.
Let me document the "technical reasons".
1- Because "f-1" should not be parsed as "f(-1)", "-1073741824" is, lexically, the unary minus operator applied to "1073741824". So, we need to be able to represent "1073741824" (the opposite of min_int) in lexer tokens.
2- Still assuming a 32-bit platform, we really want to be able to write
"x land 0x4000_0000" (or similar bit-masking operations) and not be forced to write "x land (-0x4000_0000)".
The problem reported could possibly be solved by keeping integer literals as strings during lexing and parsing, pushing their resolution into integers deeper in the compiler. But that's a lot of changes for a minor benefit. I'm suspending this PR until someone comes up with a better idea.
|2009-01-09 16:00||llb||New Issue|
|2009-01-09 16:03||llb||Note Added: 0004811|
|2009-01-14 14:05||doligez||Summary||Error => Error not raised with max_int+1 integer literal|
|2009-01-14 14:06||doligez||Note Added: 0004815|
|2009-01-14 14:06||doligez||Status||new => acknowledged|
|2012-07-11 14:59||doligez||Target Version||=> 4.01.0+dev|
|2012-07-31 13:36||doligez||Target Version||4.01.0+dev => 4.00.1+dev|
|2012-08-02 19:25||xleroy||Note Added: 0007875|
|2012-08-02 19:25||xleroy||Status||acknowledged => resolved|
|2012-08-02 19:25||xleroy||Resolution||open => suspended|
|2012-08-02 19:25||xleroy||Target Version||4.00.1+dev =>|
|Copyright © 2000 - 2011 MantisBT Group|