Re: warning: dereferencing type-punned pointer - Mailing list pgsql-hackers

From Tom Lane
Subject Re: warning: dereferencing type-punned pointer
Date
Msg-id 1251525.1721843288@sss.pgh.pa.us
Whole thread Raw
In response to Re: warning: dereferencing type-punned pointer  (Peter Eisentraut <peter@eisentraut.org>)
List pgsql-hackers
Peter Eisentraut <peter@eisentraut.org> writes:
> This is basically the textbook example of aliasing violation, isn't it? 
> Wouldn't it be just as simple to do

> memcpy(&file_crc, &disk_state, sizeof(file_crc));

+1.  Also, it seems thoroughly bizarre to me that this case is handled
before checking for read failure.  I'd move the stanza to after the
"if (readBytes < 0)" one.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: [18] Policy on IMMUTABLE functions and Unicode updates
Next
From: Peter Eisentraut
Date:
Subject: Re: warning: dereferencing type-punned pointer