Project

General

Profile

Actions

Bug #20614

closed

Integer#size returns incorrect values on 64-bit Windows

Added by surusek (Łukasz Sur) 5 months ago. Updated 4 months ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-07-08T11:00:01Z master 02c4f0c89d [x64-mswin64_140]
[ruby-core:118483]

Description

According to the ruby/spec, 0.size should return size of the machine word in bytes, but on x64-mswin64_140 (both release 3.3.3 and git revision 02c4f0c89d) it doesn't. Following example:

a, b = 0.size, [0].pack('J').length
puts a, b

should print two 8s, but on x64-mswin64_140, a is 4.
Issue is most likely caused by use of long instead of SIGNED_VALUE in internal/fixnum.h and fix_size function in numeric.c, because on Windows, long is always a 32-bit number.

Actions

Also available in: Atom PDF

Like0
Like1Like0Like1Like0Like0Like0Like0Like0Like0