ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:99522] [Ruby master Bug#17108] error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast
@ 2020-08-09  9:43 aotto1968
  2020-08-09 10:02 ` [ruby-core:99523] " aotto1968
  2020-08-12  2:42 ` [ruby-core:99562] " nobu
  0 siblings, 2 replies; 3+ messages in thread
From: aotto1968 @ 2020-08-09  9:43 UTC (permalink / raw)
  To: ruby-core

Issue #17108 has been reported by aotto1968 (Andreas Otto).

----------------------------------------
Bug #17108: error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast
https://bugs.ruby-lang.org/issues/17108

* Author: aotto1968 (Andreas Otto)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux-gnu]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
Hi, it seems that the "OPTIMIZATION" macro for "rb_funcall" make something "bad"

||   CC       rubymsgque_la-misc_ruby.lo
|| .../misc_ruby.c: In function ‘rubymsgque_OtCheckCallable’:
.../misc_ruby.c|430 col 18| error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast [-Werror=int-conversion]
||    MQ_INT arity = VAL2INT(rb_funcall(val,NS(id_arity),0,NULL));
||                   ^~~~~~~
.../misc_ruby.c|430 col 18| note: (near initialization for ‘rb_funcall_args[0]’)                                                                                                             
|| cc1: all warnings being treated as errors

MQ_INT arity = VAL2INT(rb_funcall(val,NS(id_arity),0,NULL));

#define VAL2INT(val)        (MQ_INT)NUM2INT(val)

ID NS(id_arity);

#if defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO) && defined(__OPTIMIZE__)
# define rb_yield_values(argc, ...) \
__extension__({ \
        const int rb_yield_values_argc = (argc); \
        const VALUE rb_yield_values_args[] = {__VA_ARGS__}; \
        const int rb_yield_values_nargs = \
            (int)(sizeof(rb_yield_values_args) / sizeof(VALUE)); \
        rb_yield_values2( \
            rb_varargs_argc_check(rb_yield_values_argc, rb_yield_values_nargs), \
            rb_yield_values_nargs ? rb_yield_values_args : NULL); \
    })

# define rb_funcall(recv, mid, argc, ...) \
__extension__({ \
        const int rb_funcall_argc = (argc); \
        const VALUE rb_funcall_args[] = {__VA_ARGS__}; \
        const int rb_funcall_nargs = \
            (int)(sizeof(rb_funcall_args) / sizeof(VALUE)); \
        rb_funcallv(recv, mid, \
            rb_varargs_argc_check(rb_funcall_argc, rb_funcall_nargs), \
            rb_funcall_nargs ? rb_funcall_args : NULL); \
    })
#endif




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:99523] [Ruby master Bug#17108] error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast
  2020-08-09  9:43 [ruby-core:99522] [Ruby master Bug#17108] error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast aotto1968
@ 2020-08-09 10:02 ` aotto1968
  2020-08-12  2:42 ` [ruby-core:99562] " nobu
  1 sibling, 0 replies; 3+ messages in thread
From: aotto1968 @ 2020-08-09 10:02 UTC (permalink / raw)
  To: ruby-core

Issue #17108 has been updated by aotto1968 (Andreas Otto).

ruby -v changed from ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux-gnu] to ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux-gnu]

tested with latest RUBY -> same warning=error

----------------------------------------
Bug #17108: error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast
https://bugs.ruby-lang.org/issues/17108#change-86983

* Author: aotto1968 (Andreas Otto)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux-gnu]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
Hi, it seems that the "OPTIMIZATION" macro for "rb_funcall" make something "bad"

||   CC       rubymsgque_la-misc_ruby.lo
|| .../misc_ruby.c: In function ‘rubymsgque_OtCheckCallable’:
.../misc_ruby.c|430 col 18| error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast [-Werror=int-conversion]
||    MQ_INT arity = VAL2INT(rb_funcall(val,NS(id_arity),0,NULL));
||                   ^~~~~~~
.../misc_ruby.c|430 col 18| note: (near initialization for ‘rb_funcall_args[0]’)                                                                                                             
|| cc1: all warnings being treated as errors

MQ_INT arity = VAL2INT(rb_funcall(val,NS(id_arity),0,NULL));

#define VAL2INT(val)        (MQ_INT)NUM2INT(val)

ID NS(id_arity);

#if defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO) && defined(__OPTIMIZE__)
# define rb_yield_values(argc, ...) \
__extension__({ \
        const int rb_yield_values_argc = (argc); \
        const VALUE rb_yield_values_args[] = {__VA_ARGS__}; \
        const int rb_yield_values_nargs = \
            (int)(sizeof(rb_yield_values_args) / sizeof(VALUE)); \
        rb_yield_values2( \
            rb_varargs_argc_check(rb_yield_values_argc, rb_yield_values_nargs), \
            rb_yield_values_nargs ? rb_yield_values_args : NULL); \
    })

# define rb_funcall(recv, mid, argc, ...) \
__extension__({ \
        const int rb_funcall_argc = (argc); \
        const VALUE rb_funcall_args[] = {__VA_ARGS__}; \
        const int rb_funcall_nargs = \
            (int)(sizeof(rb_funcall_args) / sizeof(VALUE)); \
        rb_funcallv(recv, mid, \
            rb_varargs_argc_check(rb_funcall_argc, rb_funcall_nargs), \
            rb_funcall_nargs ? rb_funcall_args : NULL); \
    })
#endif




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:99562] [Ruby master Bug#17108] error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast
  2020-08-09  9:43 [ruby-core:99522] [Ruby master Bug#17108] error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast aotto1968
  2020-08-09 10:02 ` [ruby-core:99523] " aotto1968
@ 2020-08-12  2:42 ` nobu
  1 sibling, 0 replies; 3+ messages in thread
From: nobu @ 2020-08-12  2:42 UTC (permalink / raw)
  To: ruby-core

Issue #17108 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Rejected
Description updated

`rb_funcall` expects a list of `VALUE`s after the number of arguments.
I think you'll want to write:

```C
    MQ_INT arity = VAL2INT(rb_funcall(val,NS(id_arity),0));
```
or use `rb_funcallv` instead of `rb_funcall`:
```C
    MQ_INT arity = VAL2INT(rb_funcallv(val,NS(id_arity),0,NULL));
```

----------------------------------------
Bug #17108: error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast
https://bugs.ruby-lang.org/issues/17108#change-87026

* Author: aotto1968 (Andreas Otto)
* Status: Rejected
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux-gnu]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
Hi, it seems that the "OPTIMIZATION" macro for "rb_funcall" make something "bad"

```
||   CC       rubymsgque_la-misc_ruby.lo
|| .../misc_ruby.c: In function ‘rubymsgque_OtCheckCallable’:
.../misc_ruby.c|430 col 18| error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast [-Werror=int-conversion]
||    MQ_INT arity = VAL2INT(rb_funcall(val,NS(id_arity),0,NULL));
||                   ^~~~~~~
.../misc_ruby.c|430 col 18| note: (near initialization for ‘rb_funcall_args[0]’)                                                                                                             
|| cc1: all warnings being treated as errors

MQ_INT arity = VAL2INT(rb_funcall(val,NS(id_arity),0,NULL));

#define VAL2INT(val)        (MQ_INT)NUM2INT(val)

ID NS(id_arity);

#if defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO) && defined(__OPTIMIZE__)
# define rb_yield_values(argc, ...) \
__extension__({ \
        const int rb_yield_values_argc = (argc); \
        const VALUE rb_yield_values_args[] = {__VA_ARGS__}; \
        const int rb_yield_values_nargs = \
            (int)(sizeof(rb_yield_values_args) / sizeof(VALUE)); \
        rb_yield_values2( \
            rb_varargs_argc_check(rb_yield_values_argc, rb_yield_values_nargs), \
            rb_yield_values_nargs ? rb_yield_values_args : NULL); \
    })

# define rb_funcall(recv, mid, argc, ...) \
__extension__({ \
        const int rb_funcall_argc = (argc); \
        const VALUE rb_funcall_args[] = {__VA_ARGS__}; \
        const int rb_funcall_nargs = \
            (int)(sizeof(rb_funcall_args) / sizeof(VALUE)); \
        rb_funcallv(recv, mid, \
            rb_varargs_argc_check(rb_funcall_argc, rb_funcall_nargs), \
            rb_funcall_nargs ? rb_funcall_args : NULL); \
    })
#endif
```



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-12  2:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-09  9:43 [ruby-core:99522] [Ruby master Bug#17108] error: initialization of ‘long unsigned int’ from ‘void *’ makes integer from pointer without a cast aotto1968
2020-08-09 10:02 ` [ruby-core:99523] " aotto1968
2020-08-12  2:42 ` [ruby-core:99562] " nobu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).