Re: [HACKERS] 10beta1/m68k: static assertion failed: "MAXALIGN toosmall to fit int32" - Mailing list pgsql-hackers
From | Heikki Linnakangas |
---|---|
Subject | Re: [HACKERS] 10beta1/m68k: static assertion failed: "MAXALIGN toosmall to fit int32" |
Date | |
Msg-id | e0bfad8e-ec5d-28ee-ebbc-4670d465b3cf@iki.fi Whole thread Raw |
In response to | [HACKERS] 10beta1/m68k: static assertion failed: "MAXALIGN too small to fitint32" (Christoph Berg <myon@debian.org>) |
Responses |
Re: [HACKERS] 10beta1/m68k: static assertion failed: "MAXALIGN toosmall to fit int32"
Re: [HACKERS] 10beta1/m68k: static assertion failed: "MAXALIGN toosmall to fit int32" |
List | pgsql-hackers |
On 05/17/2017 10:39 PM, Christoph Berg wrote: > 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 If that's all that prevents it from working, by all means let's fix it. I think this should do it, although I don't have a system to test it on: diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.c index 0fcfcb4c78..e59154ddda 100644 --- a/src/backend/utils/mmgr/slab.c +++ b/src/backend/utils/mmgr/slab.c @@ -194,9 +194,9 @@ SlabContextCreate(MemoryContext parent, 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"); + /* Make sure the linked list node fits inside a freed chunk */ + if (chunkSize < sizeof(int)) + chunkSize = sizeof(int); /* chunk, including SLAB header (both addresses nicely aligned) */ fullChunkSize = MAXALIGN(sizeof(SlabChunk) +MAXALIGN(chunkSize)); It adds a few instructions to check that on all platforms, unless the compiler can optimize that away, but this is not performance critical. I'll commit that, barring objections. If you can verify that it fixes the problem before that, that'd be great, otherwise I guess we'll find out some time after the commit. - Heikki
pgsql-hackers by date: