1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

fix memory corruption in old GCC

This typo introduced memory corruption when __builtin_add_overflow
is not available but uint128_t is.  GCC before 5 are one of such
situatins.

See also https://rubyci.org/logs/rubyci.s3.amazonaws.com/opensuseleap/ruby-master/log/20191009T120004Z.log.html.gz
This commit is contained in:
卜部昌平 2019-10-10 00:10:14 +09:00
parent bb71a128eb
commit 9b919885a0
2 changed files with 1 additions and 2 deletions

View file

@ -427,7 +427,6 @@ tests.compact.each do |(insn, expr, *a)|
end
end
# with trace
tests.compact.each {|(insn, expr, *a)|
progn = "set_trace_func(proc{})\n" + expr

2
gc.c
View file

@ -135,7 +135,7 @@ size_add_overflow(size_t x, size_t y)
#elif defined(DSIZE_T)
RB_GNUC_EXTENSION DSIZE_T dx = x;
RB_GNUC_EXTENSION DSIZE_T dy = x;
RB_GNUC_EXTENSION DSIZE_T dy = y;
RB_GNUC_EXTENSION DSIZE_T dz = dx + dy;
p = dz > SIZE_MAX;
z = (size_t)dz;