Re: [PATCH v2] remove a warning building a test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 17, 2016 at 04:44:04PM +0100, Frediano Ziglio wrote:
> With my compile switches (which are mostly derived from RedHat spec
> file) I'm getting this warning:
> 
> stream-test.c: In function 'sock_fd_read':
> stream-test.c:66:43: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
>              *fd = *((int *) CMSG_DATA(cmsg));
>                                            ^
> 
> memcpy could decrease performance but as this is a test it's not
> an issue.

Can you avoid the warning with an additional (void *) cast?
*fd = *((int *) (void *) CMSG_DATA(cmsg))); ?

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]