pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: alignas (C11)
Date: Fri, 23 Jan 2026 12:33:26 -0500
Message-ID: <3119480.1769189606@sss.pgh.pa.us> (raw)
In-Reply-To: <0032fbcb-8fb0-4e65-8928-f2c4e9b62ba6@eisentraut.org>
References: <46f05236-d4d4-4b4e-84d4-faa500f14691@eisentraut.org>
	<0032fbcb-8fb0-4e65-8928-f2c4e9b62ba6@eisentraut.org>

Peter Eisentraut <peter@eisentraut.org> writes:
> This patch set has been committed, it looks like without buildfarm 
> complaints.

Things were fine until test_cplusplusext was added, but now
some older compilers seem to reject this in C++ mode.
For example at [1]:

make[1]: Entering directory '/home/debian/20-chimaera/buildroot/HEAD/pgsql.build/src/test/modules/test_cplusplusext'
g++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -I. -I/home/debian/20-chimaera/buildroot/HEAD/pgsql.build/../pgsql/src/test/modules/test_cplusplusext -I../../../../src/include -I/home/debian/20-chimaera/buildroot/HEAD/pgsql.build/../pgsql/src/include -D_GNU_SOURCE  -I/usr/include/libxml2     -c -o test_cplusplusext.o /home/debian/20-chimaera/buildroot/HEAD/pgsql.build/../pgsql/src/test/modules/test_cplusplusext/test_cplusplusext.cpp
In file included from /home/debian/20-chimaera/buildroot/HEAD/pgsql.build/../pgsql/src/include/postgres.h:48:0,
                 from /home/debian/20-chimaera/buildroot/HEAD/pgsql.build/../pgsql/src/test/modules/test_cplusplusext/test_cplusplusext.cpp:18:
/home/debian/20-chimaera/buildroot/HEAD/pgsql.build/../pgsql/src/include/c.h:1126:44: warning: requested alignment 4096 is larger than 128 [-Wattributes]
  alignas(PG_IO_ALIGN_SIZE) char data[BLCKSZ];
                                            ^
/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.

			regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=chimaera&dt=2026-01-23%2011%3A44%3...





view thread (17+ messages)  latest in thread

Message-ID: <3119480.1769189606@sss.pgh.pa.us>
Permalink:  ../3119480.1769189606@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3119480.1769189606@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, peter@eisentraut.org
  Subject: Re: alignas (C11)
  In-Reply-To: <3119480.1769189606@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox