10beta1/m68k: static assertion failed: "MAXALIGN too small to fit int32"

From: Christoph Berg <myon(at)debian(dot)org>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>
Subject: 10beta1/m68k: static assertion failed: "MAXALIGN too small to fit int32"
Date: 2017-05-17 19:39:57
Message-ID: 20170517193957.fwntkgi6epuso5l2@msg.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Not sure if a lot of people still care about m68k, but it's still one
of the unofficial Debian ports (it used to be the first non-x86 port
done decades ago):

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/mit-krb5 -no-pie -I../../../../src/include -I/<<PKGBUILDDIR>>/build/../src/include -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.6 -c -o slab.o /<<PKGBUILDDIR>>/build/../src/backend/utils/mmgr/slab.c
In file included from /<<PKGBUILDDIR>>/build/../src/include/postgres.h:47:0,
from /<<PKGBUILDDIR>>/build/../src/backend/utils/mmgr/slab.c:53:
/<<PKGBUILDDIR>>/build/../src/backend/utils/mmgr/slab.c: In function 'SlabContextCreate':
/<<PKGBUILDDIR>>/build/../src/include/c.h:753:7: error: static assertion failed: "MAXALIGN too small to fit int32"
do { _Static_assert(condition, errmessage); } while(0)
^
/<<PKGBUILDDIR>>/build/../src/backend/utils/mmgr/slab.c:198:2: note: in expansion of macro 'StaticAssertStmt'
StaticAssertStmt(MAXIMUM_ALIGNOF >= sizeof(int),
^~~~~~~~~~~~~~~~
<builtin>: recipe for target 'slab.o' failed
make[5]: *** [slab.o] Error 1

The code there is:

/*
* SlabContextCreate
* Create a new Slab context.
*
* parent: parent context, or NULL if top-level context
* name: name of context (for debugging --- string will be copied)
* blockSize: allocation block size
* chunkSize: allocation chunk size
*
* The chunkSize may not exceed:
* MAXALIGN_DOWN(SIZE_MAX) - MAXALIGN(sizeof(SlabBlock)) - SLAB_CHUNKHDRSZ
*
*/
MemoryContext
SlabContextCreate(MemoryContext parent,
const char *name,
Size blockSize,
Size chunkSize)
{
int chunksPerBlock;
Size fullChunkSize;
Size freelistSize;
SlabContext *slab;

StaticAssertStmt(offsetof(SlabChunk, slab) +sizeof(MemoryContext) ==
MAXALIGN(sizeof(SlabChunk)),
"padding calculation in SlabChunk is wrong");

/* otherwise the linked list inside freed chunk isn't guaranteed to fit */
StaticAssertStmt(MAXIMUM_ALIGNOF >= sizeof(int),
"MAXALIGN too small to fit int32");

/* chunk, including SLAB header (both addresses nicely aligned) */
fullChunkSize = MAXALIGN(sizeof(SlabChunk) + MAXALIGN(chunkSize));

I don't have the pg_config.h file at hand, but the 9.6 version has
this:

/* The normal alignment of `double', in bytes. */
#define ALIGNOF_DOUBLE 2

/* The normal alignment of `int', in bytes. */
#define ALIGNOF_INT 2

/* The normal alignment of `long', in bytes. */
#define ALIGNOF_LONG 2

/* The normal alignment of `long long int', in bytes. */
#define ALIGNOF_LONG_LONG_INT 2

/* The normal alignment of `short', in bytes. */
#define ALIGNOF_SHORT 2

/* Define as the maximum alignment requirement of any C data type. */
#define MAXIMUM_ALIGNOF 2

I don't think anyone is actually going to run a PG server on m68k, but
the same source package is building libpq5, which is not dispensable.

Christoph

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Piotr Stefaniak 2017-05-17 19:45:10 Re: pgindent (was Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.)
Previous Message Robert Haas 2017-05-17 19:10:53 Re: Hash Functions