Project

General

Profile

Actions

Bug #18517

closed

0 << (2**40) is NoMemoryError but 0 << (2**80) is 0

Added by Eregon (Benoit Daloze) almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
[ruby-core:107290]

Description

I've been looking at Integer#{<<,>>} with RHS bignum and long and there are several issues.

This seems a clear bug though:

$ruby -e 'p 0 << (2**40)'
-e: failed to allocate memory (NoMemoryError)
$ ruby -e 'p 0 << (2**80)'
0

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #18518: NoMemoryError + [FATAL] failed to allocate memory for twice 1 << largeRejectedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0