Bug #18330
closedMake failure on 32-bit Linux (Android) with Clang due to implicit 64-to-32-bit integer truncation
Description
Observed in crossruby CI for armv7a-android30 (http://rubyci.s3.amazonaws.com/crossruby/crossruby-master-armv7a-android30/log/20211111T210030Z.log.html.gz):
compiling io_buffer.c
io_buffer.c:297:16: error: implicit conversion loses integer precision: 'off_t' (aka 'long long') to 'size_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
size = rb_file_size(io);
~ ^~~~~~~~~~~~~~~~
io_buffer.c:881:1: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'unsigned long' [-Werror,-Wshorten-64-to-32]
DECLAIR_TYPE(u64, uint64_t, RB_IO_BUFFER_LITTLE_ENDIAN, RB_ULONG2NUM, RB_NUM2ULONG, ruby_swap64)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
io_buffer.c:855:17: note: expanded from macro 'DECLAIR_TYPE'
return wrap(value); \
~~~~ ^~~~~
io_buffer.c:882:1: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'unsigned long' [-Werror,-Wshorten-64-to-32]
DECLAIR_TYPE(U64, uint64_t, RB_IO_BUFFER_BIG_ENDIAN, RB_ULONG2NUM, RB_NUM2ULONG, ruby_swap64)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
io_buffer.c:855:17: note: expanded from macro 'DECLAIR_TYPE'
return wrap(value); \
~~~~ ^~~~~
io_buffer.c:883:1: error: implicit conversion loses integer precision: 'int64_t' (aka 'long long') to 'long' [-Werror,-Wshorten-64-to-32]
DECLAIR_TYPE(s64, int64_t, RB_IO_BUFFER_LITTLE_ENDIAN, RB_LONG2NUM, RB_NUM2LONG, ruby_swap64)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
io_buffer.c:855:17: note: expanded from macro 'DECLAIR_TYPE'
return wrap(value); \
~~~~ ^~~~~
io_buffer.c:884:1: error: implicit conversion loses integer precision: 'int64_t' (aka 'long long') to 'long' [-Werror,-Wshorten-64-to-32]
DECLAIR_TYPE(S64, int64_t, RB_IO_BUFFER_BIG_ENDIAN, RB_LONG2NUM, RB_NUM2LONG, ruby_swap64)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
io_buffer.c:855:17: note: expanded from macro 'DECLAIR_TYPE'
return wrap(value); \
~~~~ ^~~~~
5 errors generated.
gmake: *** [Makefile:435: io_buffer.o] Error 1
Updated by jaruga (Jun Aruga) over 2 years ago
For the arm32 + clang's log https://rubyci.s3.amazonaws.com/crossruby/crossruby-master-armv7a-android30/log/20211111T210030Z.log.html.gz.
If we want to add the arm32 + clang case to the pull-request timing CI, we can add the arm32 + clang case to the Cirrus CI.
Right now we have the arm32 + gcc case on Travis.
https://github.com/ruby/ruby/blob/415671a28273e5bfbe9aa00a0e386f025720ac23/.travis.yml#L122
We are using Cirrus CI for the Arm cases. Note Travis Arm pipeline is unstable for the more than 2 jobs.
https://github.com/ruby/ruby/blob/master/.cirrus.yml
Updated by Eregon (Benoit Daloze) over 2 years ago
- Assignee set to ioquatix (Samuel Williams)
Updated by ioquatix (Samuel Williams) over 2 years ago
Thanks for this report.
Updated by ioquatix (Samuel Williams) over 2 years ago
Does 32-bit Ruby support 64-bit wide integers? I guess no?
Updated by ioquatix (Samuel Williams) over 2 years ago
https://github.com/ruby/ruby/pull/5114 should fix this, but do we have 32-bit CI to confirm?
Updated by jaruga (Jun Aruga) over 2 years ago
Nice! Thanks!
Travis has the Arm 32-bit case, but not with clang but with gcc.
https://app.travis-ci.com/github/ruby/ruby/jobs/548818403
For RubyCI https://rubyci.org/ - the Raspbian 10 (arm) seems arm 32-bit. But I don't know how to login. Other servers in Ruby CI seems arm 64 bit.
Updated by ioquatix (Samuel Williams) over 2 years ago
I merged this does it look like it’s fixed from your end? The RubyCI looks okay to me.
Updated by jaruga (Jun Aruga) over 2 years ago
The RubyCI reported originally looks ok now.
crossruby-master-armv7a-android30
https://rubyci.s3.amazonaws.com/crossruby/crossruby-master-armv7a-android30/recent.html