Project

General

Profile

Actions

Bug #1296

closed

[trunk/22981] 64-bit issues on trunk in ext/zlib

Added by roberto (Ollivier Robert) about 15 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-03-16) [i386-darwin9.6.0]
Backport:
[ruby-core:22916]

Description

=begin
I've configured Ruby to be compiled in 64-bit mode under OS X 10.5.6 with gcc 4.2. I get the following warnings in ext/zlib which are a bit worrying.

gcc-4.2 -I. -I../../.ext/include/i386-darwin9.6.0 -I../../../include -I../../../ext/zlib -DRUBY_EXTCONF_H="extconf.h" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O -pipe -m64 -D_FILE_OFFSET_BITS=64 -O3 -g -Wall -Wno-unused-parameter -Wno-parentheses -Wno-missing-field-initializers -Wshorten-64-to-32 -Wpointer-arith -Wwrite-strings -o zlib.o -c ../../../ext/zlib/zlib.c
../../../ext/zlib/zlib.c: In function ‘do_checksum’:
../../../ext/zlib/zlib.c:300: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘zstream_expand_buffer’:
../../../ext/zlib/zlib.c:457: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘zstream_shift_buffer’:
../../../ext/zlib/zlib.c:550: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘zstream_passthrough_input’:
../../../ext/zlib/zlib.c:631: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘zstream_run’:
../../../ext/zlib/zlib.c:707: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘zstream_sync’:
../../../ext/zlib/zlib.c:766: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c:770: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘deflate_run’:
../../../ext/zlib/zlib.c:1167: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘do_deflate’:
../../../ext/zlib/zlib.c:1226: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘rb_deflate_set_dictionary’:
../../../ext/zlib/zlib.c:1353: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘inflate_run’:
../../../ext/zlib/zlib.c:1413: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘do_inflate’:
../../../ext/zlib/zlib.c:1467: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘rb_inflate_inflate’:
../../../ext/zlib/zlib.c:1499: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘rb_inflate_addstr’:
../../../ext/zlib/zlib.c:1532: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘rb_inflate_sync’:
../../../ext/zlib/zlib.c:1560: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘rb_inflate_set_dictionary’:
../../../ext/zlib/zlib.c:1602: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘gzfile_read_raw_ensure’:
../../../ext/zlib/zlib.c:1838: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c:1839: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c:1841: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘gzfile_read_raw_until_zero’:
../../../ext/zlib/zlib.c:1859: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘gzfile_make_header’:
../../../ext/zlib/zlib.c:1923: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c:1926: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c:1930: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘gzfile_make_footer’:
../../../ext/zlib/zlib.c:1944: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘gzfile_read_header’:
../../../ext/zlib/zlib.c:1998: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c:2001: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c:2008: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c:2015: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘gzfile_read_more’:
../../../ext/zlib/zlib.c:2078: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘gzfile_calc_crc’:
../../../ext/zlib/zlib.c:2089: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c:2093: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘gzfile_getc’:
../../../ext/zlib/zlib.c:2235: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘rb_gzwriter_write’:
../../../ext/zlib/zlib.c:2817: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘rb_gzreader_ungetc’:
../../../ext/zlib/zlib.c:3147: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c: In function ‘gzreader_gets’:
../../../ext/zlib/zlib.c:3246: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../ext/zlib/zlib.c:3272: warning: implicit conversion shortens 64-bit value into a 32-bit value
cc -dynamic -bundle -undefined suppress -flat_namespace -o ../../.ext/i386-darwin9.6.0/zlib.bundle zlib.o -L. -L../.. -L. -m64 -L/usr/local/lib -lz -lpthread -ldl -lobjc
=end

Actions #1

Updated by yugui (Yuki Sonoda) almost 15 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)
  • Target version changed from 1.9.1 to 1.9.2

=begin

=end

Actions #2

Updated by mame (Yusuke Endoh) almost 14 years ago

  • Status changed from Open to Feedback

=begin
Hi,

Is this still reproduced?
I can't confirm as I don't have os x. Could anyone confirm?

--
Yusuke Endoh
=end

Actions #3

Updated by Eregon (Benoit Daloze) almost 14 years ago

=begin
Hi,
On 29 May 2010 20:06, Yusuke Endoh wrote:

Hi,

Is this still reproduced?
I can't confirm as I don't have os x.  Could anyone confirm?

--
Yusuke Endoh

If I understand well this 'bug', it is about the C warnings: 'warning:
implicit conversion shortens 64-bit value into a 32-bit value' in
64-bit.

Well, actually there are hundreds of them:
$ cat make.log | grep 'warning: implicit conversion shortens 64-bit
value into a 32-bit value' | wc -l #=> 375

Here is by file:
$ cat make.log | grep 'warning: implicit conversion shortens 64-bit
value into a 32-bit value' | ruby -e
'ARGF.read.lines.with_object(Hash.new(0)) {|l,h| h[l.split(":")[0]] +=
1 }.each {|f,w| puts f+": #{w}"}'

regcomp.c: 18
regexec.c: 19
regparse.c: 19
./enc/emacs_mule.c: 1
./enc/euc_jp.c: 2
./enc/shift_jis.c: 1
./enc/utf_16le.c: 1
./enc/utf_32be.c: 1
./enc/utf_32le.c: 1
dbm.c: 1
cfunc.c: 1
cptr.c: 2
generator.c: 28
nkf-utf8/nkf.c: 1
ossl.c: 2
ossl_asn1.c: 25
ossl_bio.c: 1
ossl_bn.c: 4
ossl_cipher.c: 3
ossl_hmac.c: 3
ossl_ns_spki.c: 4
ossl_ocsp.c: 8
ossl_pkcs12.c: 2
ossl_pkcs5.c: 2
ossl_pkcs7.c: 2
ossl_pkey.c: 1
ossl_pkey_dh.c: 4
ossl_pkey_dsa.c: 5
ossl_pkey_ec.c: 4
ossl_pkey_rsa.c: 8
ossl_rand.c: 3
ossl_ssl.c: 6
ossl_x509attr.c: 4
ossl_x509cert.c: 2
ossl_x509ext.c: 3
ossl_x509name.c: 4
ossl_x509req.c: 2
ossl_x509store.c: 4
_sdbm.c: 4
init.c: 9
strscan.c: 3
bytecode.re: 2
emitter.c: 2
implicit.re: 5
syck.c: 1
token.re: 15
tcltklib.c: 85
tkutil.c: 15
zlib.c: 32

It would indeed be nice to not have these warnings, but I suppose it
is not so easy to solve.

Regards,
B.D.

=end

Actions #4

Updated by mame (Yusuke Endoh) almost 14 years ago

  • Priority changed from Normal to 3
  • Target version changed from 1.9.2 to 2.0.0

=begin
Hi,

Thank you, Benoit.

2010/5/30 Benoit Daloze :

Well, actually there are hundreds of them:
$ cat make.log | grep 'warning: implicit conversion shortens 64-bit
value into a 32-bit value' | wc -l #=> 375

Umm... I wonder why OP reported only about zlib's warnings.

And I remembered you had posted recent make.log in ticket #3255:
https://gist.github.com/c8034f83cc9afbf79e6b

I glanced over a part of zlib, and I guess nearly all warnings
are false positive. Some struct fields of zlib are int types,
and RSTRING_LEN(buf), which returns long type, is assigned to
the field. But the `buf' seems to be created based on int-typed
length. So the warnings are benign.

Of course some may be malignant. If anyone realizes actual issue,
please let us know.

It would indeed be nice to not have these warnings, but I suppose it
is not so easy to solve.

Agreed.
To fix them, tons of casts will be needed. I'm afraid if it may
enbug another issue. Thus, at least in 1.9.2 release, we won't
fix these warnings unless actual issue is reported.

Thanks again!

--
Yusuke Endoh
=end

Actions #5

Updated by Eregon (Benoit Daloze) almost 14 years ago

=begin
On 29 May 2010 23:30, Yusuke Endoh wrote:

Thank you, Benoit.

Yusuke Endoh

You are very welcome :)

Happy to help Ruby !

B.D.

=end

Updated by ko1 (Koichi Sasada) almost 13 years ago

Can we close this issue?

Updated by drbrain (Eric Hodel) almost 13 years ago

  • Status changed from Feedback to Closed

I no longer see these warnings on gcc 4.2.1 on OS X 10.6.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0