gcc 4.6 warning report

Lauri Kenttä lauri.kentta at gmail.com
Wed Jun 29 06:28:45 CDT 2011

On Wed, 29 Jun 2011 08:31:58 +0100, David Laight wrote:
> On Tue, Jun 28, 2011 at 03:18:47PM -0700, Juan Lang wrote:
>> >> This is a false positive. ?h_addr_list is declared as a char **, 
>> and
>> >> technically it is, but gethostbyname only returns IPv4 addresses, 
>> i.e.
>> >> ones that can fit in a DWORD.
>> >
>> > That doesn't sound like a problem that would give that warning.
>> Why not?  A cast of a pointer to a DWORD with 64-bit pointers would
>> cause truncation, if it were indeed a pointer that were being cast.
>> It isn't, even though it's declared that way.
> But 'char **h_addr_list;' is a pointer to an array of pointers
> to address buffers (defined as char) - not a pointer to an array of
> addresses.
> IIRC the 'something' will be an IPv4 address - which might
> be held as a 32 bit quantity rather that an array of char.
> But nowhere should you cast the 32bit int (DWORD) to/from a pointer 
> type.

David is right, the address is not stored as a pointer but as a DWORD 
in place of the chars. Like this:

wrong: (DWORD) host->h_addr_list[i] = 0x00cbd1c8 =
right: *(DWORD*) host->h_addr_list[i] = 0x86192ed1 =


More information about the wine-devel mailing list