diff --git a/include/ruby/internal/core/rstring.h b/include/ruby/internal/core/rstring.h index 4a8aa3f7d3..9f6dc84537 100644 --- a/include/ruby/internal/core/rstring.h +++ b/include/ruby/internal/core/rstring.h @@ -280,7 +280,7 @@ struct RString { /** Embedded contents. */ struct { #if USE_RVARGC - unsigned short len; + long len; /* This is a length 1 array because: * 1. GCC has a bug that does not optimize C flexible array members * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452) diff --git a/test/-ext-/string/test_capacity.rb b/test/-ext-/string/test_capacity.rb index 583c98fca4..6b3172a46d 100644 --- a/test/-ext-/string/test_capacity.rb +++ b/test/-ext-/string/test_capacity.rb @@ -66,7 +66,7 @@ class Test_StringCapacity < Test::Unit::TestCase def embed_header_size if GC.using_rvargc? - 2 * RbConfig::SIZEOF['void*'] + RbConfig::SIZEOF['short'] + 2 * RbConfig::SIZEOF['void*'] + RbConfig::SIZEOF['long'] else 2 * RbConfig::SIZEOF['void*'] end