From: naruse@... Date: 2021-03-14T13:38:01+00:00 Subject: [ruby-core:102847] [Ruby master Bug#17645] `shorten-64-to-32` errors with Clang 11.1.0 for 32-bit targets w.r.t. `time_t` (maybe Y2038?) Issue #17645 has been updated by naruse (Yui NARUSE). Backport changed from 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED, 3.0: REQUIRED to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED, 3.0: DONE ruby_3_0 ff2ea4daeb795ebb3d0afa8c57d86a4af9757e50 merged revision(s) 2a6bfd22468343003463e0cbf91953a01b0dbba5,3ac28de5414c81a0da8c8ec969ea74db5a0f1b0f. ---------------------------------------- Bug #17645: `shorten-64-to-32` errors with Clang 11.1.0 for 32-bit targets w.r.t. `time_t` (maybe Y2038?) https://bugs.ruby-lang.org/issues/17645#change-90907 * Author: xtkoba (Tee KOBAYASHI) * Status: Closed * Priority: Normal * ruby -v: ruby 3.1.0dev (2021-02-19 master a319c04818) [i686-linux] * Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED, 3.0: DONE ---------------------------------------- Targeting to i686-linux-gnu or armv7a-linux-gnu, Clang/LLVM 11.1.0 fails to compile `file.c`: ``` compiling file.c file.c:1256:44: error: implicit conversion loses integer precision: 'const __s64' (aka 'const long long') to 'time_t' (aka 'long') [-Werror,-Wshorten-64-to-32] return rb_time_nano_new(stx->stx_btime.tv_sec, stx->stx_btime.tv_nsec); ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~^~~~~~ 1 error generated. make: *** [Makefile:428: file.o] Error 1 ``` A workaround is to explicitly cast the first argument of `rb_time_nano_new`, as in the attached patch. It will work until 2038. ---Files-------------------------------- ruby-time_t.patch (358 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: