Project

General

Profile

Actions

Bug #18517

closed

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

Added by Eregon (Benoit Daloze) about 2 years ago. Updated about 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 #1

Updated by Eregon (Benoit Daloze) about 2 years ago

  • Related to Bug #18518: NoMemoryError + [FATAL] failed to allocate memory for twice 1 << large added
Actions #3

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

  • Status changed from Open to Closed

Applied in changeset git|6a6227e0168b059c3ed34c9f0ace2e5dc2364221.


Shifting zero always results in zero [Bug #18517]

Actions #4

Updated by byroot (Jean Boussier) about 2 years ago

  • Backport changed from 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN to 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED

Updated by naruse (Yui NARUSE) about 2 years ago

  • Backport changed from 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED to 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE

ruby_3_1 1f17463dec2ab1535096cb56005a840eae4fea5b merged revision(s) 6a6227e0168b059c3ed34c9f0ace2e5dc2364221.

Updated by nagachika (Tomoyuki Chikanaga) about 2 years ago

  • Backport changed from 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE to 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: DONE, 3.1: DONE

ruby_3_0 9c2213f6695a16917dbe7b5a3a334116d6d8bbf6 merged revision(s) 6a6227e0168b059c3ed34c9f0ace2e5dc2364221.

Actions #7

Updated by usa (Usaku NAKAMURA) about 2 years ago

  • Backport changed from 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: DONE, 3.1: DONE to 2.6: UNKNOWN, 2.7: DONE, 3.0: DONE, 3.1: DONE
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0