Skip to content

Commit 23ab41b

Browse files
committed
Fix optional/gc_specs.rb and use LL2NUM instead of LONG2NU
INT64_MAX might be long long int and there might be overflow with LONG2NU, e.g. in windows job: ``` gc_spec.c: In function 'Init_gc_spec': gc_spec.c:108:58: warning: overflow in conversion from 'long long int' to 'long int' changes value from '9223372036854775807' to '-1' [-Woverflow] 108 | registered_before_rb_global_variable_bignum = LONG2NUM(INT64_MAX); | ^~~~~~~~~ gc_spec.c:113:57: warning: overflow in conversion from 'long long int' to 'long int' changes value from '9223372036854775807' to '-1' [-Woverflow] 113 | registered_after_rb_global_variable_bignum = LONG2NUM(INT64_MAX); | ^~~~~~~~~ ```
1 parent 118bfc5 commit 23ab41b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

optional/capi/ext/gc_spec.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ void Init_gc_spec(void) {
105105
registered_before_rb_gc_register_address = rb_str_new_cstr("registered before rb_gc_register_address()");
106106

107107
registered_before_rb_global_variable_string = rb_str_new_cstr("registered before rb_global_variable()");
108-
registered_before_rb_global_variable_bignum = LONG2NUM(INT64_MAX);
108+
registered_before_rb_global_variable_bignum = LL2NUM(INT64_MAX);
109109
registered_before_rb_global_variable_float = DBL2NUM(3.14);
110110

111111
registered_after_rb_global_variable_string = rb_str_new_cstr("registered after rb_global_variable()");
112112
rb_global_variable(&registered_after_rb_global_variable_string);
113-
registered_after_rb_global_variable_bignum = LONG2NUM(INT64_MAX);
113+
registered_after_rb_global_variable_bignum = LL2NUM(INT64_MAX);
114114
rb_global_variable(&registered_after_rb_global_variable_bignum);
115115
registered_after_rb_global_variable_float = DBL2NUM(6.28);
116116
rb_global_variable(&registered_after_rb_global_variable_float);

0 commit comments

Comments
 (0)