Jim Meyering wrote:

Testing on i686 at all was mostly on a whim.
This is not a release blocker, by a long shot.

True. Still, it's annoying. I built GCC 4.7.2 and reproduced the bug. We had a workaround for this bug in m4/stdalign.m4 and lib/stdalign.in.h, but the workaround failed if -std=gnu11 was specified. The attached patch (installed into gnulib) fixed it for me.
From df082835cb4d3488aff930b2e1a2bc8cdeaacea4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Sun, 18 Oct 2015 22:18:49 -0700
Subject: [PATCH] stdalign: work around pre-4.9 GCC x86 bug

* lib/stdalign.in.h (_Alignof): Work around bug in pre-4.9 GCC on
x86, when -std=gnu11 is used.  Problem reported by Jim Meyering in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-10/msg00038.html
---
 ChangeLog         | 7 +++++++
 lib/stdalign.in.h | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ae7ec70..a17429b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-10-18  Paul Eggert  <egg...@cs.ucla.edu>
+
+       stdalign: work around pre-4.9 GCC x86 bug
+       * lib/stdalign.in.h (_Alignof): Work around bug in pre-4.9 GCC on
+       x86, when -std=gnu11 is used.  Problem reported by Jim Meyering in:
+       http://lists.gnu.org/archive/html/bug-gnulib/2015-10/msg00038.html
+
 2015-10-18  Pádraig Brady  <p...@draigbrady.com>
 
        maint.mk: sc_tight_scope: remove extraneous expressions
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
index 9a7d5ed..227eaf3 100644
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -52,7 +52,10 @@
 #undef _Alignas
 #undef _Alignof
 
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+/* GCC releases before GCC 4.9 had a bug in _Alignof.  See GCC bug 52023
+   <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.  */
+#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
+     || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9)))
 # ifdef __cplusplus
 #  if 201103 <= __cplusplus
 #   define _Alignof(type) alignof (type)
-- 
2.1.0

Reply via email to