Project

General

Profile

Actions

Backport #7946

closed

1.9.3-p385以降でclangでのビルド時にエラー(error: implicit conversion loses integer precision)

Added by d6rkaiz (Isao Sugimoto) over 11 years ago. Updated over 11 years ago.

Status:
Closed
[ruby-dev:47096]

Description

=begin

OS X 10.8.2でclangでビルドを行う際にruby 1.9.3-p385以降でclangでコンパイル時にエラーとなるようになりました。

バグとのことですので報告します。
1.9.3-p385 および 1.9.3-p392 で発生します。

 BUILD FAILED
 
 Inspect or clean up the working tree at /var/folders/t0/n008mdzj4nz0_cswflz6xwch0000gn/T/ruby-build.20130223143931.52037
 Results logged to /var/folders/t0/n008mdzj4nz0_cswflz6xwch0000gn/T/ruby-build.20130223143931.52037.log
 
 Last 10 log lines:
 compiling safe.c
 compiling signal.c
 compiling sprintf.c
 compiling st.c
 st.c:520:35: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
             i = table->num_entries++;
               ~ ~~~~~~~~~~~~~~~~~~^~
 1 error generated.
 make: *** [st.o] Error 1
 make: *** Waiting for unfinished jobs....

clangのバージョンなど

 $ clang -v
 Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
 Target: x86_64-apple-darwin12.2.1
 Thread model: posix

参考 http://qiita.com/items/e7c4374d25ba2056a7b7

=end


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #7938: Stack consistency error while compiling 2.0.0-p0Third Party's Issuemrkn (Kenta Murata)02/24/2013Actions

Updated by sorah (Sorah Fukumori) over 11 years ago

  • Assignee set to mrkn (Kenta Murata)

Updated by naruse (Yui NARUSE) over 11 years ago

I noticed that clang version 4.1 doesn't fail.

% clang --version
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.1
Thread model: posix

But clang version 4.2 fails.

% clang --version
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.1
Thread model: posix

Anyway Ruby should avoid this.

Actions #3

Updated by naruse (Yui NARUSE) over 11 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport193
  • Status changed from Open to Assigned
  • Assignee changed from mrkn (Kenta Murata) to usa (Usaku NAKAMURA)
  • Priority changed from Normal to 5

1.9.3 のみに影響します。以下のパッチで回避できます。

Index: st.c

--- st.c (revision 39476)
+++ st.c (working copy)
@@ -515,7 +515,7 @@
st_index_t hash_val, bin_pos;

 if (table->entries_packed) {
  •    int i;
    
  •    st_index_t i;
       if (MORE_PACKABLE_P(table)) {
           i = table->num_entries++;
           table->bins[i*2] = (struct st_table_entry*)key;
    

Index: thread.c

--- thread.c (revision 39476)
+++ thread.c (working copy)
@@ -2161,7 +2161,7 @@
static int
vm_living_thread_num(rb_vm_t *vm)
{

  • return vm->living_threads->num_entries;
  • return (int)vm->living_threads->num_entries;
    }

int

Actions #4

Updated by usa (Usaku NAKAMURA) over 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39503.
Isao, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • st.c (st_add_direct): int is not always same with st_index_t. some
    version of clang reports error.

  • thread.c (vm_living_thread_num): ditto.
    reported by d6rkaiz (Isao Sugimoto) at [ruby-dev:47096]
    [Backport #7946]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0