bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] stdalign: port better to MSVC and to Sun C 5.11


From: Paul Eggert
Subject: Re: [PATCH] stdalign: port better to MSVC and to Sun C 5.11
Date: Tue, 01 Nov 2011 09:09:51 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110927 Thunderbird/7.0

On 11/01/11 05:00, Bruno Haible wrote:
> It was here:
> <https://lists.gnu.org/archive/html/bug-gnulib/2011-10/msg00300.html>

Thanks, I added that to the ChangeLog.

> 1) On mingw of 2009, the test fails
> 
> test-stdalign.c:81: assertion failed
> FAIL: test-stdalign.exe

I don't use mingw, but I Googled around and discovered that the mingw
linker doesn't support alignments greater than 8.  That's all Emacs
needs, so the simplest fix is to change the test so that it tests 8
rather than 16, and to document the restriction.

> 2) On Solaris 10 (both SPARC and i386) with cc, the test fails:
> 
> test-stdalign.c:81: assertion failed
> FAIL: test-stdalign

Yes, I can reproduce this, and it's already documented in
stdalign.texi.  This is a bug in Sun C 5.11, which can occur when you
declare lots of external variables with alignments, interleaved with
typedefs and some other stuff.  GNU Emacs does not trigger the bug,
and I imagine that the bug is not that likely in practice.  For now, I
thought it best to document the bug and to have the test case fail if
the bug is present.  I just now filed a bug report with Oracle
<http://bugreport.sun.com/bugreport/index.jsp> but do not have a bugid
or response yet.

I pushed the following patches:

>From c02ca4beb2f8185226ac7315d2271cc587a1a4a6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Tue, 1 Nov 2011 08:13:21 -0700
Subject: [PATCH 1/2] Fix my old ChangeLog entry to properly cite Bruno's
 email.

---
 ChangeLog |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 763f9be..1c6d1f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,8 +32,8 @@
 2011-10-31  Paul Eggert  <address@hidden>
 
        stdalign: port better to MSVC and to Sun C 5.11
-       I think these problems were reported by Bruno Haible, in email
-       that I've unfortunately misplaced.
+       This fixes some of the problems reported by Bruno Haible in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-10/msg00300.html>.
        * doc/posix-headers/stdalign.texi (stdalign.h): Document more
        shortcomings of MSVC and of Sun C 5.11.
        * lib/stdalign.in.h (_Alignas): Omit bogus extra parenthesis
-- 
1.7.6.4


>From 086fbef22c89b68e37680edd5b00211f96d6e1de Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Tue, 1 Nov 2011 08:22:55 -0700
Subject: [PATCH 2/2] * tests/test-stdalign.c (TEST_ALIGNMENT): Shrink back to
 8.

mingw supports alignments only up to 8 (!).  Reported by Bruno Haible in
<http://lists.gnu.org/archive/html/bug-gnulib/2011-11/msg00006.html>.
* doc/posix-headers/stdalign.texi (stdalign.h): Document this.
---
 ChangeLog                       |    7 +++++++
 doc/posix-headers/stdalign.texi |    3 +++
 tests/test-stdalign.c           |    4 +++-
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1c6d1f0..7a1eac5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-11-01  Paul Eggert  <address@hidden>
+
+       * tests/test-stdalign.c (TEST_ALIGNMENT): Shrink back to 8.
+       mingw supports alignments only up to 8 (!).  Reported by Bruno Haible in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-11/msg00006.html>.
+       * doc/posix-headers/stdalign.texi (stdalign.h): Document this.
+
 2011-11-01  Bruno Haible  <address@hidden>
 
        alignof: Avoid collision with stdalign module.
diff --git a/doc/posix-headers/stdalign.texi b/doc/posix-headers/stdalign.texi
index c5fbc5f..9d2499a 100644
--- a/doc/posix-headers/stdalign.texi
+++ b/doc/posix-headers/stdalign.texi
@@ -29,6 +29,9 @@ Some compilers do not support alignment via
 variables on the stack).  They diagnose and ignore the alignment: Sun
 C 5.11.
 @item
+Some linkers do not support operands of @code{_Alignas}/@code{alignas}
+that are greater than 8: mingw.
address@hidden
 Some compilers require the operand of @code{_Alignas}/@code{alignas}
 to be a single integer constant, not an expression: MSVC 7.0 through
 at least 10.0.
diff --git a/tests/test-stdalign.c b/tests/test-stdalign.c
index c1d8677..66a2040 100644
--- a/tests/test-stdalign.c
+++ b/tests/test-stdalign.c
@@ -43,7 +43,9 @@ verify (__alignas_is_defined == 1);
 # ifndef alignas
 #  error "alignas is not a macro"
 # endif
-# define TEST_ALIGNMENT 16
+/* mingw can go up only to 8.  8 is all that GNU Emacs needs, so let's
+   limit the test to 8 for now.  */
+# define TEST_ALIGNMENT 8
 #else
 # define _Alignas(alignment)
 # define alignas(alignment)
-- 
1.7.6.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]