| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Cc: | Tatsuo Ishii <ishii(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: warning: dereferencing type-punned pointer |
| Date: | 2024-07-24 18:29:45 |
| Message-ID: | 1256314.1721845785@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
BTW, I tried the same experiment of building without
-fno-strict-aliasing using gcc 11.4.1 (from RHEL9).
I see one more warning than Tatsuo-san did:
In file included from verify_heapam.c:18:
verify_heapam.c: In function ‘check_tuple_attribute’:
../../src/include/access/toast_internals.h:37:11: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
37 | (((toast_compress_header *) (ptr))->tcinfo >> VARLENA_EXTSIZE_BITS)
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
verify_heapam.c:1693:24: note: in expansion of macro ‘TOAST_COMPRESS_METHOD’
1693 | cmid = TOAST_COMPRESS_METHOD(&toast_pointer);
| ^~~~~~~~~~~~~~~~~~~~~
This looks a bit messy to fix: we surely don't want to pierce
the abstraction TOAST_COMPRESS_METHOD provides. Perhaps
the toast_pointer local variable could be turned into a union
of struct varatt_external and toast_compress_header, but that
would impose a good deal of notational overhead on the rest
of this function.
The good news is that we get through check-world (although
I didn't try very many build options).
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2024-07-24 18:31:41 | Re: warning: dereferencing type-punned pointer |
| Previous Message | Peter Eisentraut | 2024-07-24 18:26:55 | Re: warning: dereferencing type-punned pointer |