pkgsrc-Changes archive

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

Re: CVS commit: pkgsrc/net/libfetch

"John Marino" <> writes:

> Module Name:  pkgsrc
> Committed By: marino
> Date:         Sun Oct  7 07:23:21 UTC 2012
> Modified Files:
>       pkgsrc/net/libfetch: Makefile
> Log Message:
> net/libfetch: Fix for gcc4.7
> When building with gcc4.7, libfetch fails with the following error:
>   ftp.c: In function 'unmappedaddr':
>   ftp.c:149:2: error: dereferencing type-punned pointer will break
>                strict-aliasing rules [-Werror=strict-aliasing]
>   cc1: all warnings being treated as errors
>   *** Error code 1
> The code is intentionally grouping an array of four uint8_t bytes into a
> uint32_t word.  Add -Wno-strict-aliasing in makefile to fix build in gcc4.7.

But isn't the warning correct, in that dereferencing a uint32 pointer
does not guarantee data coherency for objects of other types?  AIUI, in
C99, the compiler is free to let objects of type other than foo have
inconsistent values while a foo* is being dereferenced, and is only
obligated to ensure consistency of objects of type foo.  It seems in
modern C, one must use a union for such overlays.

Attachment: pgpsIdW2XHwB0.pgp
Description: PGP signature

Home | Main Index | Thread Index | Old Index