Project

General

Profile

Actions

Bug #18517

closed

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

Added by Eregon (Benoit Daloze) 5 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
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 (1 open0 closed)

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

Also available in: Atom PDF