On Mon, Jan 29, 2024 at 06:53:55PM +0000, Richard W.M. Jones wrote:
> With GCC 14 the code failed to compile on i686 (and was wrong for any
> version of GCC):
> 
> ../block/blkio.c: In function ‘blkio_file_open’:
> ../block/blkio.c:857:28: error: passing argument 3 of ‘blkio_get_uint64’ from 
> incompatible pointer type [-Wincompatible-pointer-types]
>   857 |                            &s->mem_region_alignment);
>       |                            ^~~~~~~~~~~~~~~~~~~~~~~~
>       |                            |
>       |                            size_t * {aka unsigned int *}
> In file included from ../block/blkio.c:12:
> /usr/include/blkio.h:49:67: note: expected ‘uint64_t *’ {aka ‘long long 
> unsigned int *’} but argument is of type ‘size_t *’ {aka ‘unsigned int *’}
>    49 | int blkio_get_uint64(struct blkio *b, const char *name, uint64_t 
> *value);
>       |                                                         
> ~~~~~~~~~~^~~~~

I wish gcc could point this out even when compiling on a 64-bit
platform where size_t and uint64_t happen to share the same type, by
reasoning about the underlying typedefs being different.  But that's a
bigger task for gcc, and not one for this group.

> 
> Signed-off-by: Richard W.M. Jones <rjo...@redhat.com>
> ---
>  block/blkio.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

Reviewed-by: Eric Blake <ebl...@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org


Reply via email to