[Top][All Lists]

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

AC_CHECK_ALIGNOF cross-compile detection fails with newer gcc and offset

From: Mike Frysinger
Subject: AC_CHECK_ALIGNOF cross-compile detection fails with newer gcc and offsetof fallback
Date: Thu, 6 Sep 2012 15:00:57 -0400

if a package doesn't happen to include stddef.h before trying to do
AC_CHECK_ALIGNOF, the current cross-compile fallback fails with newer

for example, see the attached generated conftest.c (taken from recent
glib versions) where it does:
AC_CHECK_TYPE([guint32],,,[typedef unsigned $gint32 guint32;])
typedef unsigned $gint32 guint32;])

compiling this gcc-4.5+ fails (checked 4.4.7, 4.5.3, 4.6.3, and 4.7.1):
$ gcc -O2 conftest.c
conftest.c: In function ‘main’:
conftest.c:216:12: error: storage size of ‘test_array’ isn’t constant

if, however, we happen to pull in the stddef.h from gcc which now
includes an offsetof definition itself (which uses a builtin),
everything works nicely:
$ gcc -O2 conftest.c -DSTDC_HEADERS

perhaps one fix would be for AC_CHECK_ALIGNOF to require AC_STDC_HEADERS ?

Attachment: conftest.c
Description: Text Data

reply via email to

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