From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Strange test in stdalign.m4 Date: Fri, 29 Mar 2013 17:57:21 +0300 Message-ID: <8338ve5k4u.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1364569082 25406 80.91.229.3 (29 Mar 2013 14:58:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Mar 2013 14:58:02 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 29 15:58:29 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ULal9-0007ka-6s for ged-emacs-devel@m.gmane.org; Fri, 29 Mar 2013 15:58:27 +0100 Original-Received: from localhost ([::1]:55710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULakk-00007m-LY for ged-emacs-devel@m.gmane.org; Fri, 29 Mar 2013 10:58:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULakf-00007f-U5 for emacs-devel@gnu.org; Fri, 29 Mar 2013 10:58:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULakd-0001fP-Mk for emacs-devel@gnu.org; Fri, 29 Mar 2013 10:57:57 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:49098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULakd-0001f9-Db for emacs-devel@gnu.org; Fri, 29 Mar 2013 10:57:55 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MKF00I00G3FI200@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Fri, 29 Mar 2013 17:57:00 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MKF00IHJG70BX30@a-mtaout20.012.net.il>; Fri, 29 Mar 2013 17:57:00 +0300 (IDT) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158426 Archived-At: The test program from m4/stdalign.m4, viz.: #include #include /* Test that alignof yields a result consistent with offsetof. This catches GCC bug 52023 . */ #ifdef __cplusplus template struct alignof_helper { char a; t b; }; # define ao(type) offsetof (alignof_helper, b) #else # define ao(type) offsetof (struct { char a; type b; }, b) #endif char test_double[ao (double) % _Alignof (double) =3D=3D 0 ? 1 : -1]= ; char test_long[ao (long int) % _Alignof (long int) =3D=3D 0 ? 1 : -= 1]; char test_alignof[alignof (double) =3D=3D _Alignof (double) ? 1 : -= 1]; /* Test _Alignas only on platforms where gnulib can help. */ #if (__GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <=3D __SUNPRO_C |= | 1300 <=3D _MSC_VER) int alignas (8) alignas_int =3D 1; char test_alignas[_Alignof (alignas_int) =3D=3D 8 ? 1 : -1]; #endif int main () { return 0; } seems to always fail. This line: char test_alignas[_Alignof (alignas_int) =3D=3D 8 ? 1 : -1]; emits the following diagnostics: ta.c:36: error: expected specifier-qualifier-list before =E2=80= =98alignas_int=E2=80=99 ta.c:36: error: =E2=80=98struct =E2=80=99 has no member = named =E2=80=98__b=E2=80=99 My understanding is that _Alignof accepts a data type as its argument= , whereas alignas_int is not a data type. If I use typeof, like this: char test_alignas[_Alignof (typeof(alignas_int)) =3D=3D 8 ? 1 : -1]= ; then the error is ta.c:36: error: size of array =E2=80=98test_alignas=E2=80=99 is neg= ative which means alignas didn't really work, right? This fails the configure test of stdalign.h, even if I replace stdalign.h with lib/stdalign.in.h, a gnulib replacement, which is supposed to be correct. I tried this with 2 different versions of GCC on 2 different systems, with the same results. What am I missing here? Why does the test fail? TIA