Re: warning: dereferencing type-punned pointer
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Tatsuo Ishii <ishii@postgresql.org>, pgsql-hackers@postgresql.org
Date: 2024-07-24T17:48:08Z
Lists: 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
Commits
-
Fix a strict aliasing violation
- 2fcc5a715130 19 (unreleased) landed
-
Add input function for data type pg_ndistinct
- 44eba8f06e55 19 (unreleased) cited