Project

General

Profile

Bug #11343

random.c: getrandom compile error with clang

Added by Hanmac (Hans Mackowiak) over 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:69931]

Description

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

Updated by Hanmac (Hans Mackowiak) over 5 years ago

  • Description updated (diff)
  • Assignee set to nobu (Nobuyoshi Nakada)
#2

Updated by Anonymous over 5 years ago

  • Status changed from Open to Closed

Applied in changeset r51240.


fix compile error with clang

  • random.c (fill_random_bytes_syscall): fix compile error with clang. [ruby-core:69931] [Bug #11343]

Updated by nobu (Nobuyoshi Nakada) about 5 years ago

  • Description updated (diff)
  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED

Please backport r51242 to 2.2.

Updated by nagachika (Tomoyuki Chikanaga) about 5 years ago

  • Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE

Backported r51242 into ruby_2_2 branch at r52778.

Also available in: Atom PDF