Project

General

Profile

Actions

Bug #3761

closed

List of possible casting issues under LLP64

Added by luislavena (Luis Lavena) about 14 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3dev (2010-08-29 trunk 29141) [i386-mingw32]
Backport:
[ruby-core:31932]

Description

=begin
Hello,

working on getting Ruby (trunk and 1.9.2) build under mingw-w64 compiler. Since Windows uses LLP64 instead of LP64, sveral warnings from compilation in 32bits might shed some light for fixing.

These warnings are around pointer casting:


 In file included from ../../../../ruby/thread.c:204:0:
 ../../../../ruby/thread_win32.c: In function 'w32_wait_events':
 ../../../../ruby/thread_win32.c:126:13: warning: comparison between signed and unsigned integer expressions
 ../../../../ruby/thread_win32.c:129:13: warning: comparison between signed and unsigned integer expressions
 ../../../../ruby/thread_win32.c: In function 'w32_resume_thread':
 ../../../../ruby/thread_win32.c:170:30: warning: comparison between signed and unsigned integer expressions
 
 
 ../../../../../../ruby/ext/openssl/ossl_hmac.c: In function 'ossl_hmac_hexdigest':
 ../../../../../../ruby/ext/openssl/ossl_hmac.c:162:49: warning: comparison between signed and unsigned integer expressions
 ../../../../../../ruby/ext/openssl/ossl_hmac.c: In function 'ossl_hmac_s_hexdigest':
 ../../../../../../ruby/ext/openssl/ossl_hmac.c:225:49: warning: comparison between signed and unsigned integer expressions
 
 ../../../../../../ruby/ext/openssl/ossl_pkcs7.c: In function 'ossl_pkcs7_sym2typeid':
 ../../../../../../ruby/ext/openssl/ossl_pkcs7.c:376:18: warning: comparison between signed and unsigned integer expressions
 
 ../../../../../../ruby/ext/openssl/ossl_pkey_ec.c: In function 'ossl_ec_group_set_seed':
 ../../../../../../ruby/ext/openssl/ossl_pkey_ec.c:1110:89: warning: comparison between signed and unsigned integer expressions
 
 ../../../../../../ruby/ext/openssl/ossl_ssl_session.c: In function 'ossl_ssl_session_to_der':
 ../../../../../../ruby/ext/openssl/ossl_ssl_session.c:208:15: warning: comparison between signed and unsigned integer expressions
 
 
 ../../../../../../ruby/ext/socket/raddrinfo.c: In function 'init_addrinfo':
 ../../../../../../ruby/ext/socket/raddrinfo.c:581:27: warning: comparison between signed and unsigned integer expressions
 ../../../../../../ruby/ext/socket/raddrinfo.c: In function 'inspect_sockaddr':
 ../../../../../../ruby/ext/socket/raddrinfo.c:939:35: warning: comparison between signed and unsigned integer expressions
 ../../../../../../ruby/ext/socket/raddrinfo.c:952:48: warning: comparison between signed and unsigned integer expressions
 ../../../../../../ruby/ext/socket/raddrinfo.c:965:35: warning: comparison between signed and unsigned integer expressions
 ../../../../../../ruby/ext/socket/raddrinfo.c:987:49: warning: comparison between signed and unsigned integer expressions
 

=end


Files

export-symbols-for-dll-under-64bits.patch (544 Bytes) export-symbols-for-dll-under-64bits.patch luislavena (Luis Lavena), 09/24/2010 03:01 AM
Actions #1

Updated by luislavena (Luis Lavena) about 14 years ago

=begin
Hello wanabe

I see in r29320 that you added mingw64 but specified basic_machine as i386-pc

I believe that is not correct. mingw-w64 targeting 64bits should be x86_64 as as architecture, no?

Thank you.

=end

Actions #2

Updated by wanabe (_ wanabe) about 14 years ago

=begin
Hello,

I see in r29320 that you added mingw64 but specified basic_machine as i386-pc

I believe that is not correct. mingw-w64 targeting 64bits should be x86_64 as as architecture, no?

Sorry, you are right.
I will change it as soon as possible.
=end

Actions #3

Updated by wanabe (_ wanabe) about 14 years ago

=begin

I will change it as soon as possible.
Oh, already fixed at r29324. Thanks to Nakada-san.
=end

Actions #4

Updated by luislavena (Luis Lavena) about 14 years ago

=begin
Thank you wanabe and Nakada-san.

I'm having other warnings related to gc:


 x86_64-w64-mingw32-gcc -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -I. -I.ext/include/x86_64-mingw32 -I../include -I.. -include ruby/config.h -include ruby/missing.h -DRUBY_EXPORT   -o gc.o -c ../gc.c
 ../gc.c: In function ‘obj_free’:
 ../gc.c:2193:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 ../gc.c: In function ‘rb_objspace_call_finalizer’:
 ../gc.c:2908:7: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 

Looking at both lines of the warnings seems that pointer is been casted to (long)

Changing that to size_t (the supposed to be pointer size) solve the issue in both part of the equality check:

From:

if ((long)RANY(obj)->as.data.dfree == -1) {

To:

if ((size_t)RANY(obj)->as.data.dfree == (size_t)-1) {

But I'm unsure of the implications. The warning is solve but I'm ignorant on the correctness.

What do you think?

Thank you for working on this.

=end

Actions #5

Updated by luislavena (Luis Lavena) about 14 years ago

=begin
Mr. wanabe:

In r29320 you also introduced Exports::Mingw64 which is never going to be called becase RUBY_PLATFORM is x86_64-mingw32. It differs form mswin32 and mswin64 because MinGW is still mingw32, just it changes the architecture.

The attached patch brings the new regexp from Mingw64 into Mingw32 itself so symbols are properly exported for 64bits (there is no mangling/underscore as 32bits one)

Please verify the correctness of this patch and feel free to apply it. If doesn't fit this Bug report, I can open a new one for it.

Thank you in advance for your time.
=end

Actions #7

Updated by shyouhei (Shyouhei Urabe) about 14 years ago

  • Status changed from Open to Assigned
  • Assignee set to wanabe (_ wanabe)

=begin

=end

Actions #8

Updated by wanabe (_ wanabe) about 14 years ago

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

=begin
This issue was solved with changeset r29346.
Luis, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0