summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-19 08:46:41 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-19 08:46:41 +0000
commit5bb48dc68ad35a78659d3075a9e3172785dcfbeb (patch)
tree14ed27ad4df0a37611d05b39f36cafce5bd3561e
parent1b30f57c8fda3ad0a9b88cba5ab2a28fc17a3d90 (diff)
compile.c: default_len is positive
Recent GCC warns that default_len can be negative (thus can overflow PTRDIFF_MAX), which is a false assert. Suppresses warnings by adding __builtin_unreachable. See also: https://travis-ci.org/ruby/ruby/jobs/443568193#L2227 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 2a4680476b..272b9ddacc 100644
--- a/compile.c
+++ b/compile.c
@@ -8083,6 +8083,9 @@ iseq_build_kw(rb_iseq_t *iseq, VALUE params, VALUE keywords)
keyword->table = ids;
return keyword;
}
+ else if (default_len < 0) {
+ UNREACHABLE;
+ }
dvs = ALLOC_N(VALUE, (unsigned int)default_len);