| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: alignas (C11) |
| Date: | 2026-01-23 22:00:43 |
| Message-ID: | 48e2bb94-be07-4f22-ba8a-545e252e4ac4@eisentraut.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 23.01.26 18:33, Tom Lane wrote:
^
> /home/debian/20-chimaera/buildroot/HEAD/pgsql.build/../pgsql/src/include/c.h:1132:49: warning: requested alignment 4096 is larger than 128 [-Wattributes]
> alignas(PG_IO_ALIGN_SIZE) char data[XLOG_BLCKSZ];
> ^
>
> Not sure what to do about that, but I do read it as indicating that we
> cannot put any faith in the compiler to honor such large alignment
> demands.
>
> A possible short-term(?) workaround is to wrap those two declarations
> in "#ifndef __cplusplus", so that C++ code can't declare such
> variables.
It looks like this was a bug in g++:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70066
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89357
The suggestion there appears to be that it was fixed in gcc 9, but on
the buildfarm it only goes up to 6.
I think we could work around it like this:
#if defined(__cplusplus) && defined(__GNUC__) && __GNUC__ <= 6
#define alignas(a) __attribute__((aligned(a)))
#endif
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-01-23 22:18:44 | Re: alignas (C11) |
| Previous Message | Jelte Fennema-Nio | 2026-01-23 21:29:28 | Re: New year, new commitfest app improvements |