[前][次][番号順一覧][スレッド一覧]

ruby-changes:69820

From: Yusuke <ko1@a...>
Date: Fri, 19 Nov 2021 10:12:06 +0900 (JST)
Subject: [ruby-changes:69820] 4b1dd75e6c (master): gc.c: Fix a compile error on some crossbuilds

https://git.ruby-lang.org/ruby.git/commit/?id=4b1dd75e6c

From 4b1dd75e6c4308801156b4839662868be8676ff0 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Fri, 19 Nov 2021 10:09:51 +0900
Subject: gc.c: Fix a compile error on some crossbuilds

http://rubyci.s3.amazonaws.com/crossruby/crossruby-master-wasm32_emscripten/log/20211118T233311Z.log.html.gz#make
```
compiling gc.c
gc.c:10629:47: error: implicit conversion loses integer precision: 'unsigned long long' to 'size_t' (aka 'unsigned long') [-Werror,-Wshorten-64-to-32]
    SET(time, objspace->profile.total_time_ns / (1000 * 1000) /* ns -> ms */);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gc.c:10624:9: note: expanded from macro 'SET'
        return attr; \
        ~~~~~~ ^~~~
gc.c:10629:47: error: implicit conversion loses integer precision: 'unsigned long long' to 'unsigned long' [-Werror,-Wshorten-64-to-32]
    SET(time, objspace->profile.total_time_ns / (1000 * 1000) /* ns -> ms */);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gc.c:10626:68: note: expanded from macro 'SET'
        rb_hash_aset(hash, gc_stat_symbols[gc_stat_sym_##name], SIZET2NUM(attr));
                                                                ~~~~~~~~~ ^~~~
2 errors generated.
```
---
 gc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gc.c b/gc.c
index 0bb44d24ae2..60387d2ab3b 100644
--- a/gc.c
+++ b/gc.c
@@ -10626,7 +10626,7 @@ gc_stat_internal(VALUE hash_or_sym) https://github.com/ruby/ruby/blob/trunk/gc.c#L10626
 	rb_hash_aset(hash, gc_stat_symbols[gc_stat_sym_##name], SIZET2NUM(attr));
 
     SET(count, objspace->profile.count);
-    SET(time, objspace->profile.total_time_ns / (1000 * 1000) /* ns -> ms */);
+    SET(time, (size_t) (objspace->profile.total_time_ns / (1000 * 1000) /* ns -> ms */)); // TODO: UINT64T2NUM
 
     /* implementation dependent counters */
     SET(heap_allocated_pages, heap_allocated_pages);
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]