David Fang wrote:
Does this mean that it falls back to the distributed copy in gl/stdalign.h?
Yes, actually, it's basically a copy of gl/stdalign.in.h.
I don't see any evidence of the replacement stdalign.h being tested in
config.log.
The replacement is not tested, because its runtime behavior can't easily be
tested with cross-compilation.
Do you observe the same problem with Apple's GCC 4.2?
Do the attached patches work around the problem for you? The second one's for
HP compilers and you can ignore it if you like.
>From 905233bd1b667d87ad5b801c2d2613d7eb075799 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Tue, 16 Dec 2014 17:29:33 -0800
Subject: [PATCH 1/2] stdalign: work around Apple GCC 4.0 bug
Reported by David Fang in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-12/msg00194.html
* lib/stdalign.in.h (_Alignas):
* m4/stdalign.m4 (gl_STDALIGN_H):
Do not use aligned attribute with GCC 4.0 on Apple.
---
ChangeLog | 9 +++++++++
lib/stdalign.in.h | 5 ++++-
m4/stdalign.m4 | 5 ++++-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d654b60..a2c5645 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-12-16 Paul Eggert <egg...@cs.ucla.edu>
+
+ stdalign: work around Apple GCC 4.0 bug
+ Reported by David Fang in:
+ http://lists.gnu.org/archive/html/bug-gnulib/2014-12/msg00194.html
+ * lib/stdalign.in.h (_Alignas):
+ * m4/stdalign.m4 (gl_STDALIGN_H):
+ Do not use aligned attribute with GCC 4.0 on Apple.
+
2014-12-16 Pádraig Brady <p...@draigbrady.com>
getcwd: fix test failure on OS X 10.9
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
index 32ae4c5..dd25f04 100644
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -95,7 +95,10 @@
#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
# if defined __cplusplus && 201103 <= __cplusplus
# define _Alignas(a) alignas (a)
-# elif (__GNUC__ || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \
+# elif ((defined __APPLE__ && defined __MACH__ \
+ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
+ : __GNUC__) \
+ || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \
|| __ICC || 0x5110 <= __SUNPRO_C)
# define _Alignas(a) __attribute__ ((__aligned__ (a)))
# elif 1300 <= _MSC_VER
diff --git a/m4/stdalign.m4 b/m4/stdalign.m4
index 9efafe5..2b1f90e 100644
--- a/m4/stdalign.m4
+++ b/m4/stdalign.m4
@@ -32,7 +32,10 @@ AC_DEFUN([gl_STDALIGN_H],
/* Test _Alignas only on platforms where gnulib can help. */
#if \
((defined __cplusplus && 201103 <= __cplusplus) \
- || __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC \
+ || (defined __APPLE__ && defined __MACH__ \
+ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
+ : __GNUC__) \
+ || __IBMC__ || __IBMCPP__ || __ICC \
|| 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
struct alignas_test { char c; char alignas (8) alignas_8; };
char test_alignas[offsetof (struct alignas_test, alignas_8) == 8
--
1.9.3
>From 09a5bbd66179d88f96e508fbd17dd3020275ff36 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Tue, 16 Dec 2014 17:57:23 -0800
Subject: [PATCH 2/2] stdalign: port better to HP compilers
* m4/stdalign.m4 (gl_STDALIGN_H): Try the test if __HP_cc or
__HP_aCC are nonzero, to be consistent with the 2014-01-20 patch.
---
ChangeLog | 4 ++++
m4/stdalign.m4 | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a2c5645..877a721 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2014-12-16 Paul Eggert <egg...@cs.ucla.edu>
+ stdalign: port better to HP compilers
+ * m4/stdalign.m4 (gl_STDALIGN_H): Try the test if __HP_cc or
+ __HP_aCC are nonzero, to be consistent with the 2014-01-20 patch.
+
stdalign: work around Apple GCC 4.0 bug
Reported by David Fang in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-12/msg00194.html
diff --git a/m4/stdalign.m4 b/m4/stdalign.m4
index 2b1f90e..f60257f 100644
--- a/m4/stdalign.m4
+++ b/m4/stdalign.m4
@@ -35,8 +35,9 @@ AC_DEFUN([gl_STDALIGN_H],
|| (defined __APPLE__ && defined __MACH__ \
? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
: __GNUC__) \
- || __IBMC__ || __IBMCPP__ || __ICC \
- || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
+ || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \
+ || __ICC || 0x5110 <= __SUNPRO_C \
+ || 1300 <= _MSC_VER)
struct alignas_test { char c; char alignas (8) alignas_8; };
char test_alignas[offsetof (struct alignas_test, alignas_8) == 8
? 1 : -1];
--
1.9.3