On 12/11/19 6:43 PM, Bruno Haible wrote:
../../gltests/test-stdalign.c:94: assertion '(uintptr_t) &(static_char_Alignas) % TEST_ALIGNMENT == 0' failed IOT/Abort trap (core dumped)
With xlclang 16.01, __attribute__ ((__aligned__ (N))) does not work on external variables; the attribute is ignored. Curious, since the attribute does work with plain xlc. Anyway, I installed the attached patch to work around the problem.
The following program illustrates the bug, which occurs with both _Alignas and __attribute__ ((__aligned__)). Perhaps if someone reading this knows how to file a bug report with IBM (I don't and couldn't easily find out), they could file a bug report against xlclang.
char _Alignas (8) c1, c2; char __attribute__ ((__aligned__ (8))) c3, c4; int main (void) { if ((unsigned long) &c1 % 8 != 0) return 1; if ((unsigned long) &c2 % 8 != 0) return 2; if ((unsigned long) &c3 % 8 != 0) return 3; if ((unsigned long) &c4 % 8 != 0) return 4; return 0; }
>From 7de83dd63256de8945aa06cf6ec85d64e1eea522 Mon Sep 17 00:00:00 2001 From: Paul Eggert <egg...@cs.ucla.edu> Date: Thu, 12 Dec 2019 10:16:13 -0800 Subject: [PATCH] stdalign: port to xlclang 16.01 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem reportd by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2019-12/msg00064.html * lib/stdalign.in.h (_Alignas): Do not use __attribute__ ((__aligned__ (...))) with xlclang, as a top-level ‘char __attribute__ ((__aligned__ (8))) c;’ does not work with xlclang version 16.01.0000.0001; the alignment directive is ignored. --- ChangeLog | 10 ++++++++++ lib/stdalign.in.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6f4f764de..a22fa7229 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2019-12-12 Paul Eggert <egg...@cs.ucla.edu> + + stdalign: port to xlclang 16.01 + Problem reportd by Bruno Haible in: + https://lists.gnu.org/r/bug-gnulib/2019-12/msg00064.html + * lib/stdalign.in.h (_Alignas): Do not use __attribute__ + ((__aligned__ (...))) with xlclang, as a top-level + ‘char __attribute__ ((__aligned__ (8))) c;’ does not work with + xlclang version 16.01.0000.0001; the alignment directive is ignored. + 2019-12-12 Bruno Haible <br...@clisp.org> duplocale: Fix test failure on AIX 7.2 with xlclang. diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h index 5c2c72e2b..257c33764 100644 --- a/lib/stdalign.in.h +++ b/lib/stdalign.in.h @@ -102,7 +102,7 @@ # define _Alignas(a) alignas (a) # elif ((defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ - : __GNUC__) \ + : __GNUC__ && !defined __ibmxl__) \ || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__) # define _Alignas(a) __attribute__ ((__aligned__ (a))) -- 2.23.0