Bug 427146 - valgrind.h: 64bit mingw: cast from pointer to integer of different size
Summary: valgrind.h: 64bit mingw: cast from pointer to integer of different size
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-30 11:31 UTC by Christoph Reiter
Modified: 2020-09-30 11:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Reiter 2020-09-30 11:31:40 UTC
This is in glib, but I've copied over the valgrind.h from git master and the same warning occurs.

It looks like the code assumes that a pointer can fit into "unsigned long int", but on 64 bit Windows that's not the case. My guess would be that it should use "uintptr_t" instead.

../gobject/gtype.c: In function 'g_type_create_instance':
../gobject/../glib/valgrind.h:417:20: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  417 |     _zzq_args[1] = (unsigned long int)(_zzq_arg1);                \
      |                    ^
../gobject/../glib/valgrind.h:203:15: note: in expansion of macro 'VALGRIND_DO_CLIENT_REQUEST_EXPR'
  203 |   do { (void) VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                        \
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../gobject/../glib/valgrind.h:6479:5: note: in expansion of macro 'VALGRIND_DO_CLIENT_REQUEST_STMT'
 6479 |     VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MALLOCLIKE_BLOCK,       \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../gobject/gtype.c:1844:7: note: in expansion of macro 'VALGRIND_MALLOCLIKE_BLOCK'
 1844 |       VALGRIND_MALLOCLIKE_BLOCK (allocated + private_size, ivar_size + sizeof (gpointer), 0, TRUE);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~
../gobject/../glib/valgrind.h:417:20: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  417 |     _zzq_args[1] = (unsigned long int)(_zzq_arg1);                \
      |                    ^
../gobject/../glib/valgrind.h:203:15: note: in expansion of macro 'VALGRIND_DO_CLIENT_REQUEST_EXPR'
  203 |   do { (void) VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                        \