Issue #11343 has been updated by Hans Mackowiak.

Description updated
Assignee set to Nobuyoshi Nakada

----------------------------------------
Bug #11343: random.c: getrandom compile error with clang
https://bugs.ruby-lang.org/issues/11343#change-53354

* Author: Hans Mackowiak
* Status: Open
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------

`
random.c:526:8: error: implicit conversion loses integer precision: 'long' to 'int' [-Werror,-Wshorten-64-to-32]
ret = syscall(SYS_getrandom, seed, size, 0);
`

which does make the build of clang fail


and there is a warning in rb_ary_new too

`
enum.c:766:11: warning: unused typedef 'static_assert_rb_ary_new_from_args_check' [-Wunused-local-typedef]
values = rb_ary_new3(1, i);

./include/ruby/intern.h:91:21: note: expanded from macro 'rb_ary_new3'
#define rb_ary_new3 rb_ary_new_from_args

./internal.h:649:6: note: expanded from macro 'rb_ary_new_from_args'
STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \

./internal.h:79:48: note: expanded from macro 'STATIC_ASSERT'
# define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]

<scratch space>:354:1: note: expanded from here
static_assert_rb_ary_new_from_args_check

`




-- 
https://bugs.ruby-lang.org/